제출 #1066755

#제출 시각아이디문제언어결과실행 시간메모리
1066755sleepntsheepAlternating Current (BOI18_alternating)C++17
19 / 100
26 ms2924 KiB
#include <stdio.h> #include <algorithm> #include <vector> #include <utility> using namespace std; using iii = pair<pair<int, int>, int>; int n, m; char ans[1<<18]; iii a[1<<18]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < m; ++i) scanf("%d%d", &a[i].first.first, &a[i].first.second), a[i].second = i; sort(a, a + m); int e1 = 0, e2 = 0; for (int j = 0, i = 1; i <= n; ++i) { while (j < m and a[j].first.first == i) { if (e1 <= e2) { e1 = max(e1, a[j].first.second); ans[a[j].second] = '1'; } else { e2 = max(e2, a[j].first.second); ans[a[j].second] = '0'; } ++j; } if (e1 < i or e2 < i) { puts("impossible"); return 0; } } puts(ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

alternating.cpp: In function 'int main()':
alternating.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
alternating.cpp:17:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  for (int i = 0; i < m; ++i) scanf("%d%d", &a[i].first.first, &a[i].first.second), a[i].second = i;
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...