Submission #98037

#TimeUsernameProblemLanguageResultExecution timeMemory
98037dndhkWorst Reporter 2 (JOI16_worst_reporter2)C++14
0 / 100
2 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int MAX_N = 200000; int N; deque<pii> dq1, dq2; int cnt1[MAX_N+1], cnt2[MAX_N+1]; int ans; int main(){ scanf("%d", &N); ans = N; for(int i=0; i<N; i++){ int a, b; scanf("%d%d", &a, &b); dq1.push_back({a, b}); cnt1[a]++; }for(int i=0; i<N; i++){ int a, b; scanf("%d%d", &a, &b); dq2.push_back({a, b}); } for(int i=0; i<N; i++){ if(!dq1.empty() && dq1.front().second > dq2[i].second){ if(cnt2[dq1.front().first]>0) cnt2[dq1.front().first]--; else cnt1[dq1.front().first]--; dq1.pop_front(); } if(cnt1[dq2[i].first]>0){ cnt1[dq2[i].first]--; cnt2[dq2[i].first]++; ans--; } } printf("%d", ans); return 0; }

Compilation message (stderr)

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
worst_reporter2.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
worst_reporter2.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; 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...