Submission #534604

# Submission time Handle Problem Language Result Execution time Memory
534604 2022-03-08T11:40:35 Z almothana05 Carnival (CEOI14_carnival) C++14
100 / 100
9 ms 712 KB
// #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

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 time Memory Grader output
1 Correct 8 ms 584 KB Output is correct
2 Correct 8 ms 584 KB Output is correct
3 Correct 5 ms 584 KB Output is correct
4 Correct 4 ms 712 KB Output is correct
5 Correct 5 ms 584 KB Output is correct
6 Correct 4 ms 584 KB Output is correct
7 Correct 6 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 584 KB Output is correct
2 Correct 9 ms 584 KB Output is correct
3 Correct 4 ms 584 KB Output is correct
4 Correct 5 ms 584 KB Output is correct
5 Correct 5 ms 584 KB Output is correct
6 Correct 7 ms 584 KB Output is correct
7 Correct 9 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 584 KB Output is correct
2 Correct 8 ms 584 KB Output is correct
3 Correct 7 ms 584 KB Output is correct
4 Correct 4 ms 584 KB Output is correct
5 Correct 7 ms 584 KB Output is correct
6 Correct 7 ms 584 KB Output is correct
7 Correct 8 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 584 KB Output is correct
2 Correct 4 ms 584 KB Output is correct
3 Correct 4 ms 584 KB Output is correct
4 Correct 4 ms 700 KB Output is correct
5 Correct 6 ms 584 KB Output is correct
6 Correct 6 ms 584 KB Output is correct
7 Correct 8 ms 584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 584 KB Output is correct
2 Correct 4 ms 584 KB Output is correct
3 Correct 6 ms 584 KB Output is correct
4 Correct 8 ms 584 KB Output is correct
5 Correct 7 ms 584 KB Output is correct
6 Correct 5 ms 584 KB Output is correct
7 Correct 4 ms 584 KB Output is correct