Submission #611883

# Submission time Handle Problem Language Result Execution time Memory
611883 2022-07-29T08:18:33 Z 조영욱(#8499) Izlet (COI19_izlet) C++17
25 / 100
685 ms 38196 KB
#include <bits/stdc++.h>
using namespace std;

int n;
int arr[3001][3001];
int col[3001];
int cnt=0;
bool used[3001];

int main() {
    int s;
    scanf("%d",&s);
    scanf("%d",&n);
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=n;j++) {
            scanf("%d",&arr[i][j]);
        }
    }
    for(int i=1;i<=n;i++) {
        if (arr[1][i]==cnt+1) {
            cnt++;
            col[i]=cnt;
            continue;
        }
        memset(used,0,sizeof(used));
        for(int j=i-1;j>0;j--) {
            if (used[col[j]]) {
                continue;
            }
            if (arr[j+1][i]==arr[j][i]) {
                col[i]=col[j];
                break;
            }
            used[col[j]]=true;
        }
    }
    for(int i=1;i<=n;i++) {
        printf("%d ",col[i]);
    }
    printf("\n");
    for(int i=1;i<n;i++) {
        printf("%d %d\n",i,i+1);
    }
    return 0;
}

Compilation message

izlet.cpp: In function 'int main()':
izlet.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&s);
      |     ~~~~~^~~~~~~~~
izlet.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
izlet.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |             scanf("%d",&arr[i][j]);
      |             ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Integer 0 violates the range [1, 30]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 593 ms 36212 KB Output is correct
2 Correct 608 ms 38024 KB Output is correct
3 Correct 671 ms 36964 KB Output is correct
4 Correct 685 ms 37060 KB Output is correct
5 Correct 580 ms 38196 KB Output is correct
6 Correct 609 ms 36864 KB Output is correct
7 Correct 424 ms 31356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Integer 0 violates the range [1, 30]
2 Halted 0 ms 0 KB -