답안 #1058684

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1058684 2024-08-14T12:12:29 Z user736482 Light Bulbs (EGOI24_lightbulbs) C++17
22 / 100
686 ms 440 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,t,n,x,y,m;
bool tocout[100];
vector<int>vertical,horizontal;
bool ifstar=1;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    vertical.push_back(0);
    for(int i=1;i<n*n;i++){
        cout<<"?\n";
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if((j==0 && k==0)||j*n+k==i)
                    cout<<1;
                else
                    cout<<0;
            }
            cout<<endl;
        }
        cin>>a;
        if(a==2*n-1)
            horizontal.push_back(i);
        else
            vertical.push_back(i);
    }
    vector<int>saved;
    saved.push_back(vertical[0]);
    tocout[vertical[0]]=1;
    for(int i=1;i<vertical.size();i++){
        cout<<"?\n";
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(j*n+k==vertical[i])
                    cout<<1;
                else
                    cout<<tocout[j*n+k];
            }
            cout<<endl;
        }
        cin>>a;
        if(a==saved.size()*n+n){
            saved.push_back(vertical[i]);
            tocout[vertical[i]]=1;
        }
    }
    if(saved.size()==n){
        cout<<"!\n";
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                cout<<tocout[j*n+k];
            }
            cout<<endl;
        }
        return 0;
    }
    for(int i=0;i<100;i++)
        tocout[i]=0;
    saved.clear();
    saved.push_back(horizontal[0]);
    tocout[horizontal[0]]=1;
    for(int i=1;i<horizontal.size();i++){
        cout<<"?\n";
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(j*n+k==horizontal[i])
                    cout<<1;
                else
                    cout<<tocout[j*n+k];
            }
            cout<<endl;
        }
        cin>>a;
        if(a==saved.size()*n+n){
            saved.push_back(horizontal[i]);
            tocout[horizontal[i]]=1;
        }
    }
    if(saved.size()==n){
        cout<<"!\n";
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                cout<<tocout[j*n+k];
            }
            cout<<endl;
        }
        return 0;
    }
    cout<<2137;
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i=1;i<vertical.size();i++){
      |                 ~^~~~~~~~~~~~~~~~
Main.cpp:45:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   45 |         if(a==saved.size()*n+n){
      |            ~^~~~~~~~~~~~~~~~~~
Main.cpp:50:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   50 |     if(saved.size()==n){
      |        ~~~~~~~~~~~~^~~
Main.cpp:65:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for(int i=1;i<horizontal.size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~
Main.cpp:77:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   77 |         if(a==saved.size()*n+n){
      |            ~^~~~~~~~~~~~~~~~~~
Main.cpp:82:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   82 |     if(saved.size()==n){
      |        ~~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 2 ms 344 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 2 ms 344 KB Output is correct
29 Correct 2 ms 344 KB Output is correct
30 Correct 2 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 3 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 2 ms 344 KB Output is correct
36 Correct 2 ms 344 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
38 Correct 3 ms 344 KB Output is correct
39 Correct 3 ms 344 KB Output is correct
40 Correct 2 ms 344 KB Output is correct
41 Correct 2 ms 344 KB Output is correct
42 Correct 2 ms 344 KB Output is correct
43 Correct 2 ms 344 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 2 ms 344 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 2 ms 344 KB Output is correct
56 Correct 2 ms 344 KB Output is correct
57 Correct 1 ms 344 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Partially correct 2 ms 344 KB Partially correct
19 Partially correct 2 ms 344 KB Partially correct
20 Partially correct 2 ms 344 KB Partially correct
21 Partially correct 1 ms 344 KB Partially correct
22 Partially correct 1 ms 344 KB Partially correct
23 Partially correct 2 ms 344 KB Partially correct
24 Correct 1 ms 344 KB Output is correct
25 Partially correct 2 ms 344 KB Partially correct
26 Partially correct 1 ms 344 KB Partially correct
27 Partially correct 2 ms 340 KB Partially correct
28 Partially correct 3 ms 344 KB Partially correct
29 Partially correct 2 ms 344 KB Partially correct
30 Partially correct 2 ms 344 KB Partially correct
31 Partially correct 1 ms 344 KB Partially correct
32 Partially correct 2 ms 344 KB Partially correct
33 Partially correct 2 ms 344 KB Partially correct
34 Partially correct 2 ms 344 KB Partially correct
35 Partially correct 2 ms 344 KB Partially correct
36 Partially correct 2 ms 344 KB Partially correct
37 Partially correct 1 ms 344 KB Partially correct
38 Partially correct 2 ms 344 KB Partially correct
39 Partially correct 2 ms 344 KB Partially correct
40 Partially correct 2 ms 344 KB Partially correct
41 Partially correct 1 ms 344 KB Partially correct
42 Partially correct 2 ms 344 KB Partially correct
43 Partially correct 1 ms 344 KB Partially correct
44 Partially correct 1 ms 344 KB Partially correct
45 Partially correct 1 ms 344 KB Partially correct
46 Partially correct 1 ms 344 KB Partially correct
47 Partially correct 2 ms 344 KB Partially correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 0 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 1 ms 344 KB Output is correct
52 Partially correct 2 ms 344 KB Partially correct
53 Partially correct 1 ms 344 KB Partially correct
54 Partially correct 1 ms 344 KB Partially correct
55 Partially correct 2 ms 344 KB Partially correct
56 Partially correct 2 ms 344 KB Partially correct
57 Partially correct 1 ms 344 KB Partially correct
58 Partially correct 2 ms 344 KB Partially correct
59 Runtime error 686 ms 440 KB Execution killed with signal 13
60 Halted 0 ms 0 KB -