Submission #260798

#TimeUsernameProblemLanguageResultExecution timeMemory
260798arnold518Library (JOI18_library)C++14
19 / 100
3027 ms376 KiB
#include "library.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1000; int N; vector<int> todo, T, ans; void Solve(int _N) { N=_N; for(int i=1; i<=N; i++) todo.push_back(i); ans=vector<int>(N); T=vector<int>(N, 1); int now=0; for(int j=0; j+1<todo.size(); j++) { int p=todo[j]; T[p-1]=0; int q=Query(T); if(q==1) now=p; T[p-1]=1; } if(now==0) now=todo.back(); for(int j=0; j<todo.size(); j++) if(todo[j]==now) { todo.erase(todo.begin()+j); break; } ans[0]=now; for(int i=2; i<=N; i++) { T=vector<int>(N, 1); for(auto it : todo) T[it-1]=0; int now=0; for(int j=0; j+1<todo.size(); j++) { int p=todo[j]; T[p-1]=1; int q=Query(T); if(q==1) now=p; T[p-1]=0; } if(now==0) now=todo.back(); for(int j=0; j<todo.size(); j++) if(todo[j]==now) { todo.erase(todo.begin()+j); break; } ans[i-1]=now; } Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:23:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int j=0; j+1<todo.size(); j++)
               ~~~^~~~~~~~~~~~
library.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int j=0; j<todo.size(); j++) if(todo[j]==now)
               ~^~~~~~~~~~~~
library.cpp:44:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j+1<todo.size(); j++)
                ~~~^~~~~~~~~~~~
library.cpp:53:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j<todo.size(); j++) if(todo[j]==now)
                ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...