Submission #1042064

#TimeUsernameProblemLanguageResultExecution timeMemory
1042064AbdullahIshfaqCarnival (CEOI14_carnival)C++14
0 / 100
2 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 1000000007 ll ask(ll x , ll y){ cout << y - x + 1 << " "; for(int i = x ; i <= y ; i++){ cout << i << " "; } cout << endl; int c; cin >> c; return c; } void solve(){ ll w , f , n , summ = 0; cin >> n; vector<ll> ans(n + 1); ans[1] = 1; set<ll> st; for(int i = 2; i <= n ;i ++){ st.clear(); for(int j = 1 ; j <= i -1;j++){ st.insert(ans[j]); } ll x = ask(1, i); if(st.size() != x){ ans[i] = x; continue; } ll l = 1,r= i; while(r - l > 1){ ll mid = (l + r) / 2; st.clear(); for(int j = mid; j<= i - 1;j ++){ st.insert(ans[j]); } x = ask(mid , i); cout << st.size() << " "<< x << '\n'; if(st.size() == x){ l = mid; } else{ r = mid; } } ans[i] = ans[l]; } cout << 0 << " "; for(int i = 1; i<=n ; i++){ cout << ans[i] << " "; } cout << endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int tests = 1; // cin >> tests; for (int i = 1; i <= tests; i++){ solve(); } return 0; }

Compilation message (stderr)

carnival.cpp: In function 'void solve()':
carnival.cpp:28:22: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   28 |         if(st.size() != x){
      |            ~~~~~~~~~~^~~~
carnival.cpp:41:26: warning: comparison of integer expressions of different signedness: 'std::set<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   41 |             if(st.size() == x){
      |                ~~~~~~~~~~^~~~
carnival.cpp:17:8: warning: unused variable 'w' [-Wunused-variable]
   17 |     ll w , f , n , summ = 0;
      |        ^
carnival.cpp:17:12: warning: unused variable 'f' [-Wunused-variable]
   17 |     ll w , f , n , summ = 0;
      |            ^
carnival.cpp:17:20: warning: unused variable 'summ' [-Wunused-variable]
   17 |     ll w , f , n , summ = 0;
      |                    ^~~~
#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...