Submission #750392

#TimeUsernameProblemLanguageResultExecution timeMemory
750392vjudge1Carnival (CEOI14_carnival)C++17
100 / 100
13 ms324 KiB
#include "bits/stdc++.h" //#include "/Library/Developer/CommandLineTools/usr/include/c++/v1/bits/stdc++.h" using namespace std; #define IOS ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0); #define foru(j, a, b) for(int j = a; j <= b; ++j) #define ford(j, a, b) for(int j = a; j >= b; --j) #define mp make_pair #define endl '\n' #define ll long long const int maxN = 1e5 + 5; const int mod = 1e9 + 7; const ll inf = 1e14; vector<int> costume; int ans[maxN]; signed main(){ IOS //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n, val; cin >> n; foru(i, 1, n){ cout << costume.size() + 1 << " "; for(int j = 0; j < costume.size(); j++) cout << costume[j] << " "; cout << i << endl; cout << flush; cin >> val; if(val == costume.size() + 1){ ans[i] = costume.size() + 1; costume.push_back(i); } else{ int l = 0, r = costume.size() - 1; if(l == r){ ans[i] = ans[1]; continue; } while(l < r){ int mid = (l + r) >> 1; cout << mid - l + 2 << " "; for(int j = l; j <= mid; j++) cout << costume[j] << " "; cout << i << endl; cout << flush; cin >> val; if(val == 1){ ans[i] = ans[costume[l]]; break; } if(val == mid - l + 1){ r = mid; } else{ cout << r - mid + 1 << " "; for(int j = mid + 1; j <= r; j++) cout << costume[j] << " "; cout << i << endl; cout << flush; cin >> val; if(val == 1){ ans[i] = ans[costume[r]]; break; } if(val == r - mid){ l = mid + 1; } } } } } cout << 0 << " "; foru(j, 1, n) cout << ans[j] << " "; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:25:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int j = 0; j < costume.size(); j++) cout << costume[j] << " ";
      |                        ~~^~~~~~~~~~~~~~~~
carnival.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         if(val == costume.size() + 1){
      |            ~~~~^~~~~~~~~~~~~~~~~~~~~
#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...