Submission #212239

#TimeUsernameProblemLanguageResultExecution timeMemory
212239shahadbalghonaimChameleon's Love (JOI20_chameleon)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "chameleon.h" //https://cms.ioi-jp.org/tasks/chameleon/descriptionusing namespace std; using namespace std; int binarysearch(vector<int>haha){ int start=0,end=haha.size()-1; while(start!=end-1){ int middle=(start+end)/2; vector<int>empty; for(int i=middle;i<(int)haha.size();i++){ empty.push_back(haha[i]); } if(Query(empty)==(int)empty.size()){ end=middle; } else{ start=middle; } } return end; } void sh(vector<int>&one){ if(Query(one)!=(int)one.size()){ int pos=binarysearch(one); theval[i].push_back(one[pos]); theval[one[pos]].push_back(i); one.pop_back(); } } void Solve(int N){ int n=N*2; vector<bool>solved(n+1,0); map<int,vector<int>>theval; vector<int>one; vector<int>two; vector<int>three; vector<int>four; for(int i=1;i<=n;i++){ one.push_back(i); sh(one); two.push_back(i); sh(two); three.push_back(i); sh(three); four.push_back(i); sh(four); } //the N*3 where we find the graph /*map<int,vector<int>>graph; int haha=0; for(int i=1;i<=n;i++){ if(solved[i]==1)continue; if(theval[i].size()==1){haha++;Answer(i,theval[i][0]);solved[i]=1;solved[theval[i][0]]=1;continue;} if(Query({i,theval[i][0],theval[i][1]})==1){graph[i].push_back(theval[i][2]);graph[theval[i][2]].push_back(i);} else if(Query({i,theval[i][0],theval[i][2]})==1){graph[i].push_back(theval[i][1]);graph[theval[i][1]].push_back(i);} else if(Query({i,theval[i][2],theval[i][1]})==1){graph[i].push_back(theval[i][0]);graph[theval[i][0]].push_back(i);} } for(int i=1;i<=n;i++){ if(solved[i]==1){continue;} //assert(graph[i].size()<=2); int a=graph[i][0],b=graph[i][1]; for(int j=0;j<3;j++){ if(theval[i][j]!=a&&theval[i][j]!=b&&solved[theval[i][j]]==0){Answer(i,theval[i][j]);solved[i]=1;solved[theval[i][j]]=1;break;} } }*/ }

Compilation message (stderr)

chameleon.cpp: In function 'void sh(std::vector<int>&)':
chameleon.cpp:28:13: error: 'theval' was not declared in this scope
             theval[i].push_back(one[pos]);
             ^~~~~~
chameleon.cpp:28:13: note: suggested alternative: 'timeval'
             theval[i].push_back(one[pos]);
             ^~~~~~
             timeval
chameleon.cpp:28:20: error: 'i' was not declared in this scope
             theval[i].push_back(one[pos]);
                    ^