Submission #117660

# Submission time Handle Problem Language Result Execution time Memory
117660 2019-06-17T04:47:38 Z 이온조(#2879) Izlet (COI19_izlet) C++14
0 / 100
695 ms 36104 KB
#include <bits/stdc++.h>
using namespace std;

int A[3009][3009], C[3009];

void solve(int s, int e, int st, int d) {
    if(s == e) return;
    vector<int> S = {s};
    C[s] = st;
    for(int i=s+1; i<=e; i++) {
        C[i] = st;
        if(A[s][i-1] != A[s][i]) {
            S.push_back(i);
            st += d;
        }
    }
    S.push_back(e+1);
    if((int)S.size() == 2) return;
    for(int i=1; i<S.size(); i++) solve(S[i-1], S[i] - 1, C[S[i-1]], -d);
}

int main() {
    int sub; scanf("%d",&sub);
    int N; scanf("%d",&N);
    for(int i=1; i<=N; i++) {
        for(int j=1; j<=N; j++) {
            scanf("%d",&A[i][j]);
        }
    }
    if(sub == 2) {
        solve(1, N, 1, +1);
        for(int i=1; i<=N; i++) printf("%d ", C[i]);
        for(int i=1; i<N; i++) printf("\n%d %d", i, i+1);
    }
    return 0;
}

Compilation message

izlet.cpp: In function 'void solve(int, int, int, int)':
izlet.cpp:19:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1; i<S.size(); i++) solve(S[i-1], S[i] - 1, C[S[i-1]], -d);
                  ~^~~~~~~~~
izlet.cpp: In function 'int main()':
izlet.cpp:23:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int sub; scanf("%d",&sub);
              ~~~~~^~~~~~~~~~~
izlet.cpp:24:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N; scanf("%d",&N);
            ~~~~~^~~~~~~~~
izlet.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&A[i][j]);
             ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 695 ms 36104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -