Submission #159750

#TimeUsernameProblemLanguageResultExecution timeMemory
159750geon040702줄서기 (KOI17_line)C++14
100 / 100
213 ms12572 KiB
#include <bits/stdc++.h> using namespace std; bool visit[100010]; int ans[100010]; int n, m; int main(void) { int i, j; scanf("%d%d", &n, &m); for(i=1;i<=n;i++) { ans[i] = i; } for(i=1;i<=m;i++) { int a, b; scanf("%d%d", &a, &b); ans[a]++; ans[b]--; } for(i=1;i<=n;i++) { if(visit[ans[i]]) { printf("-1\n"); exit(0); } visit[ans[i]] = 1; } for(i=1;i<=n;i++) { printf("%d ", ans[i]); } printf("\n"); return 0; }

Compilation message (stderr)

line.cpp: In function 'int main()':
line.cpp:10:12: warning: unused variable 'j' [-Wunused-variable]
     int i, j;
            ^
line.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
line.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...