Submission #153253

#TimeUsernameProblemLanguageResultExecution timeMemory
153253AlexLuchianovCarnival (CEOI14_carnival)C++14
0 / 100
2 ms380 KiB
#include <iostream> #include <fstream> #include <vector> using namespace std; #define ll long long #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MAX(a, b) (((a) < (b)) ? (b) : (a)) int const nmax = 150; vector<int> dif; vector<int> sol; bool test(int st, int val){ cout << st + 1 << " "; for(int i = 1; i <= st; i++) cout << dif[i] << " "; cout << val; cout << flush; int ans; cin >> ans; return (ans == st); } int binarysearch(int from, int to, int val){ if(from < to){ int mid = (from + to) / 2; if(test(mid, val) == 1) return binarysearch(from, mid, val); else return binarysearch(mid + 1, to, val); } else return from; } int solve(int val){ cout << dif.size() << " "; for(int i = 1;i < dif.size(); i++) cout << dif[i] << " "; cout << val; cout << flush; int sol; cin >> sol; if(sol == dif.size()) return dif.size(); else{ return binarysearch(0, dif.size() - 1, val); } } int main() { dif.push_back(0); int n; cin >> n; dif.push_back(1); sol.push_back(1); for(int i = 2;i <= n; i++){ int type = solve(i); sol.push_back(type); if(dif.size() <= type) dif.push_back(i); } cout << 0 << " "; for(int i = 0; i < n; i++) cout << sol[i] << " "; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int solve(int)':
carnival.cpp:39:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1;i < dif.size(); i++)
                 ~~^~~~~~~~~~~~
carnival.cpp:45:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(sol == dif.size())
      ~~~~^~~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:62:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(dif.size() <= type)
        ~~~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...