Submission #834934

#TimeUsernameProblemLanguageResultExecution timeMemory
834934vjudge1Zagonetka (COI18_zagonetka)C++17
9 / 100
56 ms328 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...