Submission #113997

#TimeUsernameProblemLanguageResultExecution timeMemory
113997dndhkCarnival (CEOI14_carnival)C++14
100 / 100
10 ms412 KiB
#include <bits/stdc++.h> #define pb push_back #define all(v) ((v).begin(), (v).end()) #define sortv(v) sort(all(v)) #define sz(v) ((int)(v).size()) #define uniqv(v) (v).erase(unique(all(v)), (v).end()) #define umax(a, b) (a)=max((a), (b)) #define umin(a, b) (a)=min((a), (b)) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define rep(i,n) FOR(i,1,n) #define rep0(i,n) FOR(i,0,(int)(n)-1) #define FI first #define SE second #define INF 2000000000 #define INFLL 1000000000000000000LL using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAX_N = 150; int N; int c[MAX_N+1]; vector<int> v; int calc(int x, int y){ printf("%d ", x+2); for(int i=0; i<=x; i++){ printf("%d ", v[i]); } printf("%d\n", y); fflush(stdout); int t; scanf("%d", &t); return t; } int main(){ scanf("%d", &N); v.pb(1); c[1] = 1; for(int i=2; i<=N; i++){ v.pb(i); int t; printf("%d ", v.size()); for(int j=0; j<v.size(); j++){ printf("%d ", v[j]); } printf("\n"); fflush(stdout); scanf("%d", &t); if(t!=v.size()){ v.pop_back(); int s = 0, e = v.size()-1, m; while(s<e){ m = (s+e)/2; if(calc(m, i)==m+1){ e = m; }else{ s = m+1; } } c[i] = s+1; }else{ c[i] = v.size(); } } printf("0 "); for(int i=1; i<=N; i++){ printf("%d ", c[i]); } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:48:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
   printf("%d ", v.size());
                 ~~~~~~~~^
carnival.cpp:49:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j<v.size(); j++){
                ~^~~~~~~~~
carnival.cpp:55:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(t!=v.size()){
      ~^~~~~~~~~~
carnival.cpp: In function 'int calc(int, int)':
carnival.cpp:37:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &t);
  ~~~~~^~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:42:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
carnival.cpp:54:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &t);
   ~~~~~^~~~~~~~~~
#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...