Submission #212969

#TimeUsernameProblemLanguageResultExecution timeMemory
212969NucleistThe Big Prize (IOI17_prize)C++14
Compilation error
0 ms0 KiB
int kal; dos aski[200001]; map<ve,set<int>>yo; map<int,ve>gg; int ans=0; bool vis[200001]; set<int>curi; set<dos>koli; int rod=0,belek=-1; int find_best(int n) { int county=0; rod=0;belek=n-1; for (int i = 0; i < min(n,470); ++i) { ve sal=ask(i); county++; int yol=sal[0]+sal[1]; if(yol==0)return i; kal=max(kal,yol); } queue<pair<int,dos>>q; int low=470; int high=n-1; ve last=ask(n-1); county++; if(last[0]+last[1]==0)return n-1; int med=(low+high)/2; q.push({med,{low,high}}); while(!q.empty()) { //debug(county) auto u=q.front(); q.pop(); int index=u.first; int indexa=index; int l=u.second.first; int r=u.second.second; bool ki=true; for(auto it:koli) { if(l>=it.first && r<=it.second) { ki=false;break; } } if(ki) { if(vis[index] || (l>belek || r<rod))continue; vis[index]=1; ve k = ask(index); ve kaka=k; county++; while(k[0]+k[1]!=kal && index<r) { if(k[0]==0 && k[1]==0){ debug(county) return index; } else { if(k[0]+k[1]==1) { if(k[0]==1){belek=min(belek,index-1);} else rod=max(rod,index+1); } //if(index==3273)debug(1) for(auto it:gg) { if(it.first<index) { ve cur; cur.resize(2); cur=it.second; //if(index==3273)debugs(2,it.first); if(yo.find(it.second)!=yo.end())yo[it.second].erase(it.first); //if(index==3273)debugs(2,it.first); ///if(index==3273)debug(cur[1]) cur[1]--; //if(index==3273)debugs(2,it.first); yo[cur].insert(it.first); //if(index==3273)debugs(2,it.first); } } //if(index==3273)debug(1) curi.insert(index); } index++; if(!vis[index]){k=ask(index);vis[index]=1;county++;} else k=gg[index]; } //if(index==3273)debug(1) vis[index]=1; int indexi=0,indexi1=0; for(auto it:curi) { if(it<index)indexi++; else indexi1++; } k[0]-=indexi; k[1]-=indexi1; gg[index]=k; yo[k].insert(index); bool ka=true,ka1=true; if(yo.find(k)!=yo.end()) { auto u=(*(yo[k].begin())); if(u>index){ ka1=false; koli.insert({index,u});} if(u<index) { ka=false; koli.insert({u,index}); } } if(index==3273)debug(1) //if(index!=indexa)ka=true; /*while(kaka[0]+kaka[1]!=kal && indexa>l) { if(kaka[0]==0 && kaka[1]==0){ debug(county);return indexa; } else { if(kaka[0]+kaka[1]==1) { if(kaka[0]==1){belek=min(belek,indexa-1);} else rod=max(rod,indexa+1); } for(auto it:gg) { if(it.first<indexa) { auto cur=it.second; yo[it.second].erase(it.first); it.second[1]--; yo[it.second].insert(it.first); } } curi.insert(indexa); } indexa--; if(!vis[indexa]){kaka=ask(indexa);vis[indexa]=1;county++;} else kaka=gg[indexa]; } vis[indexa]=1; indexi=0,indexi1=0; for(auto it:curi) { if(it<indexa)indexi++; else indexi1++; } kaka[0]-=indexi; kaka[1]-=indexi1; gg[indexa]=kaka; yo[kaka].insert(indexa); if(yo.find(kaka)!=yo.end()) { auto u=(*(yo[kaka].begin())); if(u<indexa)ka=false; }*/ if(!vis[(l+indexa)/2])q.push({(l+indexa)/2,{l,indexa}}); if(ka1 && !vis[(index+r)/2])q.push({(index+r)/2,{index,r}}); }} //debug(county) return 0; }

Compilation message (stderr)

prize.cpp:2:1: error: 'dos' does not name a type
 dos aski[200001];
 ^~~
prize.cpp:3:1: error: 'map' does not name a type
 map<ve,set<int>>yo;
 ^~~
prize.cpp:4:1: error: 'map' does not name a type
 map<int,ve>gg;
 ^~~
prize.cpp:7:1: error: 'set' does not name a type
 set<int>curi;
 ^~~
prize.cpp:8:1: error: 'set' does not name a type
 set<dos>koli;
 ^~~
prize.cpp: In function 'int find_best(int)':
prize.cpp:15:25: error: 'min' was not declared in this scope
     for (int i = 0; i < min(n,470); ++i)
                         ^~~
prize.cpp:17:9: error: 've' was not declared in this scope
         ve sal=ask(i);
         ^~
prize.cpp:19:17: error: 'sal' was not declared in this scope
         int yol=sal[0]+sal[1];
                 ^~~
prize.cpp:19:17: note: suggested alternative: 'kal'
         int yol=sal[0]+sal[1];
                 ^~~
                 kal
prize.cpp:21:13: error: 'max' was not declared in this scope
         kal=max(kal,yol);
             ^~~
prize.cpp:23:5: error: 'queue' was not declared in this scope
     queue<pair<int,dos>>q;
     ^~~~~
prize.cpp:23:11: error: 'pair' was not declared in this scope
     queue<pair<int,dos>>q;
           ^~~~
prize.cpp:23:16: error: expected primary-expression before 'int'
     queue<pair<int,dos>>q;
                ^~~
prize.cpp:26:5: error: 've' was not declared in this scope
     ve last=ask(n-1);
     ^~
prize.cpp:28:8: error: 'last' was not declared in this scope
     if(last[0]+last[1]==0)return n-1;
        ^~~~
prize.cpp:28:8: note: suggested alternative: 'class'
     if(last[0]+last[1]==0)return n-1;
        ^~~~
        class
prize.cpp:30:5: error: 'q' was not declared in this scope
     q.push({med,{low,high}});
     ^
prize.cpp:42:17: error: 'koli' was not declared in this scope
     for(auto it:koli)
                 ^~~~
prize.cpp:42:17: note: suggested alternative: 'ki'
     for(auto it:koli)
                 ^~~~
                 ki
prize.cpp:53:8: error: expected ';' before 'k'
     ve k = ask(index);
        ^
prize.cpp:54:8: error: expected ';' before 'kaka'
     ve kaka=k;
        ^~~~
prize.cpp:56:11: error: 'k' was not declared in this scope
     while(k[0]+k[1]!=kal && index<r)
           ^
prize.cpp:56:11: note: suggested alternative: 'ki'
     while(k[0]+k[1]!=kal && index<r)
           ^
           ki
prize.cpp:59:13: error: 'debug' was not declared in this scope
             debug(county)
             ^~~~~
prize.cpp:66:35: error: 'min' was not declared in this scope
                 if(k[0]==1){belek=min(belek,index-1);}
                                   ^~~
prize.cpp:67:26: error: 'max' was not declared in this scope
                 else rod=max(rod,index+1);
                          ^~~
prize.cpp:70:25: error: 'gg' was not declared in this scope
             for(auto it:gg)
                         ^~
prize.cpp:75:24: error: expected ';' before 'cur'
                     ve cur;
                        ^~~
prize.cpp:76:21: error: 'cur' was not declared in this scope
                     cur.resize(2);
                     ^~~
prize.cpp:76:21: note: suggested alternative: 'char'
                     cur.resize(2);
                     ^~~
                     char
prize.cpp:79:24: error: 'yo' was not declared in this scope
                     if(yo.find(it.second)!=yo.end())yo[it.second].erase(it.first);
                        ^~
prize.cpp:84:21: error: 'yo' was not declared in this scope
                     yo[cur].insert(it.first);
                     ^~
prize.cpp:89:13: error: 'curi' was not declared in this scope
             curi.insert(index);
             ^~~~
prize.cpp:92:27: error: 'ask' was not declared in this scope
         if(!vis[index]){k=ask(index);vis[index]=1;county++;}
                           ^~~
prize.cpp:93:16: error: 'gg' was not declared in this scope
         else k=gg[index];
                ^~
prize.cpp:98:17: error: 'curi' was not declared in this scope
     for(auto it:curi)
                 ^~~~
prize.cpp:103:5: error: 'k' was not declared in this scope
     k[0]-=indexi;
     ^
prize.cpp:103:5: note: suggested alternative: 'ki'
     k[0]-=indexi;
     ^
     ki
prize.cpp:105:5: error: 'gg' was not declared in this scope
     gg[index]=k;
     ^~
prize.cpp:106:5: error: 'yo' was not declared in this scope
     yo[k].insert(index);
     ^~
prize.cpp:114:9: error: 'koli' was not declared in this scope
         koli.insert({index,u});}
         ^~~~
prize.cpp:114:9: note: suggested alternative: 'ki'
         koli.insert({index,u});}
         ^~~~
         ki
prize.cpp:118:13: error: 'koli' was not declared in this scope
             koli.insert({u,index});
             ^~~~
prize.cpp:118:13: note: suggested alternative: 'ki'
             koli.insert({u,index});
             ^~~~
             ki
prize.cpp:121:20: error: 'debug' was not declared in this scope
     if(index==3273)debug(1)
                    ^~~~~
prize.cpp:168:59: error: expected primary-expression before ')' token
     if(!vis[(l+indexa)/2])q.push({(l+indexa)/2,{l,indexa}});
                                                           ^
prize.cpp:38:9: warning: unused variable 'indexa' [-Wunused-variable]
     int indexa=index;
         ^~~~~~