Show all threads Hide all threads Show all messages Hide all messages |
Be carefull !!! WA2 is simple | [RSU_Tash]Nodirbek_Kuklamov | 1680. The First Nonqualifying | 7 Dec 2022 21:12 | 4 |
You must find the first team that may go final if q wil be q+1. You mustn't output the team after q th finalist. Example: 2012 6 3 SPBU ITMO # 1 (finalist) URAL SU # 1 (finalist) SPBU ITMO # 2 SARATOV SU # 3 (finalist) URAL SU # 2 (not finalist !!!) SPBU SU # 1 (answer) Edited by author 03.12.2011 13:18 Edited by author 26.11.2019 02:40 And one more thing to look for - after the number is removed, make sure any white spaces are trimmed at the end. i.e. "SPBU SU " should be "SPBU SU" |
Очень легкая задача. | Evgeniy[VVV] | 1680. The First Nonqualifying | 3 Feb 2015 17:27 | 1 |
|
WA7 | kivi* | 1680. The First Nonqualifying | 26 Jul 2014 23:33 | 2 |
WA7 kivi* 25 Jul 2014 12:45 It's ok, i solved it. I just incorrectly deleted elements from array; |
No subject | dake | 1680. The First Nonqualifying | 30 Dec 2013 19:24 | 1 |
Deleted Edited by author 30.12.2013 20:05 |
WA test3 | Berlin | 1680. The First Nonqualifying | 1 Aug 2011 20:36 | 1 |
#include <iostream> #include <vector> #include <string> using namespace std; string read(string &s); vector<string> vec; bool isin(string s); int main() { int year,n,kol; cin>>year>>n>>kol; string s,th,st; th=read(st); for (int i=0;i<n;i++) { th=read(st);
if ((!isin(st) || vec.size()==0)) { vec.push_back(st); } if (vec.size()==kol+1) s=th;
} cout<<s<<endl; } string read(string &s) { string a,b; char c=cin.get(); bool ok=true; while (c!='\n' && !cin.eof()) { a.push_back(c); if (c=='#') ok=false; if (ok) { b.push_back(c); }
c=cin.get(); } s.clear(); s=b; return a; } bool isin(string s) { for (int i=0;i<vec.size();i++) { if (s==vec.at(i)) return true; } return false; } |
Wa2 please help,i cant find my mistake.My prog passes my all tests but stiill wa,The code is here. | Hrayr[Goris N4 High School] | 1680. The First Nonqualifying | 11 Jul 2011 18:52 | 1 |
#include <iostream> #include <cstring> #include <string> #include <fstream> using namespace std; struct team { char full[100]; char name[100]; }; team a[1005]; int q,n; bool the_same(int t1,int t2) { int i; int l1,l2; l1=strlen(a[t1].name); l2=strlen(a[t2].name); if (l1!=l2) return 0; for(i=0;i<l1-1;i++) { if (a[t1].name[i]!=a[t2].name[i]) return 0; } return 1; } void work(int t) { int j,l; l=strlen(a[t].full); if (a[t].full[l-2]=='#') { for(j=0;j<l;j++) { a[t].name[j]=a[t].full[j]; } } else { for(j=0;j<l;j++) { a[t].name[j]=a[t].full[j]; } a[t].name[l]=' '; a[t].name[l+1]='#'; a[t].name[l+2]='1'; } _strlwr(a[t].name); } void input() { //ifstream cin("input.txt"); int i,j=0,pos=5; char data[50]; char cn[10],cq[10]; cin.getline(data,50); while(data[pos]!=' ') { cn[j]=data[pos]; j++; pos++; } pos++; j=0; for(i=pos;i<strlen(data);i++) { cq[j]=data[i]; j++; } q=atoi(cq); n=atoi(cn); for(i=0;i<n;i++) { cin.getline(a[i].full,100); work(i); } } int main() { int i,j=0; input(); int k=0; for(i=0;i<q+k;i++) { for(j=0;j<i;j++) { if (the_same(i,j)) { k++; break; } } } cout<<a[q+k].full; return 0; } |
java.util.HashSet.add() method | Moonstone | 1680. The First Nonqualifying | 7 Jun 2010 14:06 | 1 |
When I used this code: if (q == 0) { out.println(fullName); return; } if (set.add(name)) q--; I got WA 2. Then I replaced it by: set.add(name); if (set.size() > q) { out.println(fullName); return; } and got AC. So, can anybody explain me why? JavaDoc says: "Returns: true if this set did not already contain the specified element", or, in our problem, if this team is the first team of this university. Can you give me a test where my first solution gets WA, and the second gets AC? P.S. I got AC WITHOUT any comparing in lowercase! Edited by author 07.06.2010 14:12 |
To those who have WA2 | gvsmirnov | 1680. The First Nonqualifying | 7 Jun 2010 13:37 | 2 |
The statement says: "If a university was presented by only one team, then its name may consists of the name of the university only" I missed this part at first and, consequently, got WA2. After fixing this got AC. Edited by author 07.06.2010 13:52 |
Why WA#2??? | Baranova_ED(YSPU) | 1680. The First Nonqualifying | 19 Oct 2009 04:29 | 5 |
Help me!! Please Edited by author 01.04.2009 01:22 Help me please!!! Edited by author 23.09.2009 02:03 Hi, Make sure you split the input string about # and then convert the university name into lowercase (or uppercase) fully because two names with the same spelling are considered to be the same. Lebron and LeBron are the same ! I just kept adding the university names into a HashSet unless its size became q + 1. and what it was ???? I convert the register of words #include <iostream> #include <stdio.h> using namespace std; struct team{ char name[35]; char name2[35]; int number; int place; }; team x[201]; int n; int fcmp(const void *p1,const void *p2){ for (int i=0;i<35;i++){ if ((*(team*)p1).name2[i]>(*(team*)p2).name2[i])return 1; if ((*(team*)p2).name2[i]>(*(team*)p1).name2[i])return -1; } return 0; } int fcmp1(const void *p1,const void *p2){ return (*(team*)p1).place-(*(team*)p2).place; } void kill(){ int j=-1; for (int i=0;i<(n);i++){ if (fcmp(&x[i],&x[i+1])){ x[++j]=x[i]; } } n=j+1; } void upper(char &a){ if ((a>=65)&&(a<=91)) a+=32; } int main(int argc, char* argv[]) { int y,q; cin>>y>>n>>q; char c; c=getchar(); for (int i=0;i<n;i++){ int h=0; char temp=1; x[i].number=1; x[i].place=i; temp=getchar(); while (temp!=10){ if (temp!='#'){ x[i].name[h++]=temp; upper(temp); x[i].name2[h-1]=temp; } else{ x[i].name[h++]='#'; x[i].name2[h-1]='#'; cin>>x[i].number; temp=10; c=getchar(); continue; } temp=getchar(); } x[i].name[h++]=0; x[i].name2[h-1]=0; } qsort(x,n,sizeof(team),fcmp); kill(); qsort(x,n,sizeof(team),fcmp1); cout<<x[q].name; if (x[q].name[strlen(x[q].name)-1]=='#') cout<<x[q].number; return 0; } |
WA#2 can anyone help me? | Time-warren258 | 1680. The First Nonqualifying | 26 Aug 2009 08:27 | 1 |
here is my code: #include<iostream> using namespace std; #include<string> #include<cctype> int main() { string str[201],universityname[201]; int n,m,i,j,k=1; cin>>n>>n>>m; getchar(); i=0; while(i<n) { getline(cin,str[i]); i++; } for(i=0;i<n;i++) { for(j=0;j<str[i].length();j++) if(str[i][j]==' '&&str[i][j+1]=='#') break; for(k=j-1;k>=0;k--) if(str[i][k]==' ') break; universityname[i].assign(str[i],0,k); } for(i=0;i<n;i++) for(j=0;j<universityname[i].length();j++) universityname[i][j]=tolower(universityname[i][j]); k=1; for(i=0;i<n;i++) { for(j=0;j<i;j++) if(universityname[i]==universityname[j]) break; else if(j==i-1) k++; if(k>=m) break; } cout<<str[i]<<endl; return 0; } Edited by author 26.08.2009 08:27 |
Why WA#2?? I make convert the university name into uppercase fully! | tester | 1680. The First Nonqualifying | 6 Aug 2009 13:12 | 1 |
Please give me test! This is my program: #include <stdio.h> #include <string.h> int main () { freopen ("input.txt","r",stdin); freopen ("output.txt","w",stdout); int n,q; char str[203][38] = {}; char monitor[203][38] = {}; int count = 0; int len = 0; scanf ("%d", &n); scanf ("%d%d", &n, &q); gets(str[0]); for (int i = 0; i < n; i++) { gets(str[i]); strcat(monitor[i],str[i]); len = strlen(str[i]); for (int j = 0; j < len; j++) { if (str[i][j] == '#') break; if ((str[i][j] < 97) && (str[i][j] != ' ') && (str[i][j] != '.') && (str[i][j] != '-') && (str[i][j] != '&') && (str[i][j] != '\n')) str[i][j] += 32; } if (str[i][len - 2] == '#') str[i][len - 1] = '\0'; } for (int i = 0; i < n; i++) { if (count == q) { printf ("%s", monitor[i]); return 0; } if (strlen(str[i]) != 0) { count++; for (int j = i + 1; j < n; j++) if (strcmp(str[i],str[j]) == 0) str[j][0] = '\0'; } } return 0; } |
WA#1 | Le Do Hoang Nam | 1680. The First Nonqualifying | 1 Mar 2009 11:14 | 1 |
WA#1 Le Do Hoang Nam 1 Mar 2009 11:14 I don't know why, something is wrong. |
TLE on 1 test | ahmedov(NUUz_2) | 1680. The First Nonqualifying | 28 Feb 2009 18:22 | 4 |
Edited by author 28.02.2009 18:30 Edited by author 28.02.2009 18:31 |