Submission #773963

# Submission time Handle Problem Language Result Execution time Memory
773963 2023-07-05T10:04:34 Z vjudge1 Zagrade (COI20_zagrade) C++17
0 / 100
0 ms 208 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
char dizi[100005];
vector <string> x;

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

int32_t main(){
    faster
    string s,gec="";
    getline(cin,s);
    cout<<endl;
    for(int i=0;i<s.length();i++){
        if(s[i]==' '){
            x.push_back(gec);
            gec="";
        }
        else{
            gec+=s[i];
        }
    }
    x.push_back(gec);
    int n=stoi(x[0]),k=stoi(x[1]);
    cout<<endl;
    vector <int> q;
    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);
        }
    }
    int gc=q.size()/2;
    for(int i=0;i<=gc-1;i++){
        dizi[q[i]]=')';
    }
    cout<<"! ";
    for(int i=1;i<=n;i++)cout<<dizi[i]<<" ";
    cout<<endl;
    //return 0;
}

Compilation message

zagrade.cpp: In function 'int32_t main()':
zagrade.cpp:20:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i=0;i<s.length();i++){
      |                 ~^~~~~~~~~~~
zagrade.cpp:30:22: warning: unused variable 'k' [-Wunused-variable]
   30 |     int n=stoi(x[0]),k=stoi(x[1]);
      |                      ^
# 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 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 Incorrect 0 ms 208 KB Answer length should be 4, but it is 1
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 -