Submission #103976

#TimeUsernameProblemLanguageResultExecution timeMemory
103976igba운세 보기 2 (JOI14_fortune_telling2)C++17
0 / 100
3 ms384 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], s[MAXN]; 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]); if(a[i] < b[i]) swap(a[i], b[i]), s[i] = 1; } for(int i = 1; i <= k; ++i) scanf("%d", &t[i]); for(int i = 1, j; i <= n; ++i) { for(j = k; j >= 1; --j) if(a[i] <= t[j]) s[i]++; else if(b[i] <= t[j]) break; ans += (s[i] % 2 ? b[i] : a[i]); } printf("%lld\n", ans); }

Compilation message (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:13: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:18: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...