답안 #834932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
834932 2023-08-23T03:18:41 Z vjudge1 Zagonetka (COI18_zagonetka) C++17
0 / 100
56 ms 332 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);
    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:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int i=0; i<v.size(); i++) {
      |                      ~^~~~~~~~~
zagonetka.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0; i<small.size(); i++) cout << small[i] << " ";
      |                  ~^~~~~~~~~~~~~
zagonetka.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for(int i=0; i<big.size(); i++) cout << big[i] << " ";
      |                  ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 46 ms 280 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 39 ms 284 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 56 ms 332 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -