Submission #834934

# Submission time Handle Problem Language Result Execution time Memory
834934 2023-08-23T03:20:55 Z vjudge1 Zagonetka (COI18_zagonetka) C++17
9 / 100
56 ms 328 KB
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
int main() {
    int n, ans;
    int p[105];
    cin >> n;
    for(int i=1; i<=n; i++) {
        cin >> p[i];
    }
    vector<int>small,big,v;
    for(int i=1; i<=n; i++) v.push_back(i);
    cout << "query ";
    for(int i=0; i<v.size(); i++) {
        cout << v[i] << " ";
    }
    cout << endl;
    cin >> ans;
    if(ans==1) {
        if(small.empty()) {
            small = v;
        } else {
            small = min(small, v);
        }
        if(big.empty()) {
            big = v;
        } else {
            big = max(big, v);
        }
    }
    while(next_permutation(v.begin(), v.end())) {
        cout << "query ";
        for(int i=0; i<v.size(); i++) {
            cout << v[i] << " ";
        }
        cout << endl;
        cin >> ans;
        if(ans==1) {
            if(small.empty()) {
                small = v;
            } else {
                small = min(small, v);
            }
            if(big.empty()) {
                big = v;
            } else {
                big = max(big, v);
            }
        }
    }
    cout << "end" << endl;
    for(int i=0; i<small.size(); i++) cout << small[i] << " ";
    cout << endl;
    for(int i=0; i<big.size(); i++) cout << big[i] << " ";
    cout << endl;
    return 0;
}

Compilation message

zagonetka.cpp: In function 'int main()':
zagonetka.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i=0; i<v.size(); i++) {
      |                  ~^~~~~~~~~
zagonetka.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |         for(int i=0; i<v.size(); i++) {
      |                      ~^~~~~~~~~
zagonetka.cpp:54:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |     for(int i=0; i<small.size(); i++) cout << small[i] << " ";
      |                  ~^~~~~~~~~~~~~
zagonetka.cpp:56:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |     for(int i=0; i<big.size(); i++) cout << big[i] << " ";
      |                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 6 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 52 ms 284 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 328 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 292 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -