Submission #534604

#TimeUsernameProblemLanguageResultExecution timeMemory
534604almothana05Carnival (CEOI14_carnival)C++14
100 / 100
9 ms712 KiB
// #include<iostream> // #include<vector> // #include<algorithm> // #include<cassert> // #include<queue> // #include<set> // #include<map> #include<bits/stdc++.h> #define mod 1000000007 #define inf 1000000000000000000 using namespace std; vector<int>pl; vector<int>kost(100000 , 0); int main() { // freopen("paint.in", "r", stdin); // freopen("paint.out", "w", stdout); // ios_base::sync_with_stdio(false); // cin.tie(NULL); int menge , numm , nummer; cin >> menge; kost[1] = 1; pl.push_back(0); pl.push_back(1); for(int i = 2 ; i <= menge ; i++){ cout << pl.size() << ' '; for(int j = 1 ; j < pl.size() ; j++){ cout << pl[j] << ' '; } cout << i << endl; cin >> numm; if(numm == pl.size()){ pl.push_back(i); kost[i] = pl.size() - 1; continue; } int st = 1 , en = pl.size() - 1 , mit; while(st <= en){ int mit = (st + en)/2; // cout << mit << ' ' << st << "\n"; cout << mit - st + 2 << ' '; for(int j = st ; j <= mit ; j++){ cout << pl[j] << ' '; } cout << i << endl; cin >> numm; if(numm == mit - st + 2){ st = mit + 1; } else{ en = mit - 1; } } kost[i] = st; } cout << 0 << ' '; for(int i = 1; i <= menge ; i++){ cout << kost[i] << ' '; } }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int j = 1 ; j < pl.size() ; j++){
      |                     ~~^~~~~~~~~~~
carnival.cpp:31:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(numm == pl.size()){
      |        ~~~~~^~~~~~~~~~~~
carnival.cpp:36:39: warning: unused variable 'mit' [-Wunused-variable]
   36 |     int st = 1 , en = pl.size() - 1 , mit;
      |                                       ^~~
carnival.cpp:19:22: warning: unused variable 'nummer' [-Wunused-variable]
   19 |   int menge , numm , nummer;
      |                      ^~~~~~
#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...