Submission #773561

# Submission time Handle Problem Language Result Execution time Memory
773561 2023-07-05T06:49:19 Z vjudge1 Zagrade (COI20_zagrade) C++17
0 / 100
1 ms 432 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 10000000005
#define mod 1000000007
char dizi[100005];
vector <int> q;

int sor(int x,int y){
    cout<<"? "<<x<<" "<<y<<" ";
    cout<<'\n';
    int m;cin>>m;
    cout<<'\n';
    return m;
}

int32_t main(){
    int n,k;cin>>n>>k;
    dizi[1]='(';
    q.push_back(1);
    for(int i=2;i<=n;i++){
        if(q.size() && sor(q.back(),i)){
            dizi[i]=')';
            q.pop_back();
        }
        else{
            dizi[i]='(';
            q.push_back(i);
        }
    }
    /*for(int i=0;i<q.size();i++)cout<<q[i]<<" ";
    cout<<endl;*/
    int gec=q.size()/2;
    //int gec=n/2;
    //cout<<"ft"<<gec<<endl;
    for(int i=0;i<q.size()-1;i++){
        dizi[q[i]]=')';
    }
    cout<<"! ";
    for(int i=1;i<=n;i++)cout<<dizi[i]<<" ";
    cout<<'\n';
}

Compilation message

zagrade.cpp: In function 'int32_t main()':
zagrade.cpp:36:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0;i<q.size()-1;i++){
      |                 ~^~~~~~~~~~~
zagrade.cpp:33:9: warning: unused variable 'gec' [-Wunused-variable]
   33 |     int gec=q.size()/2;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 432 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 2, but it is 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
2 Halted 0 ms 0 KB -