제출 #103982

#제출 시각아이디문제언어결과실행 시간메모리
103982igba운세 보기 2 (JOI14_fortune_telling2)C++17
4 / 100
3035 ms2168 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * 100100, MAXK = 2 * 100100; int n, k, a[MAXN], b[MAXN], t[MAXK]; long long ans = 0; int main() { scanf("%d %d", &n, &k); for(int i = 1; i <= n; ++i) scanf("%d %d", &a[i], &b[i]); for(int i = 1; i <= k; ++i) scanf("%d", &t[i]); for(int i = 1, swaps, j; i <= n; ++i) { for(j = k, swaps = 0; j >= 1; --j) if(max(a[i], b[i]) <= t[j]) swaps++; else if(min(a[i], b[i]) <= t[j]) { swaps += (a[i] < b[i]); break; } ans += (swaps % 2 ? b[i] : a[i]); } printf("%lld\n", ans); }

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

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