Submission #62033

#TimeUsernameProblemLanguageResultExecution timeMemory
62033mahmoudbadawyFortune Telling 2 (JOI14_fortune_telling2)C++17
4 / 100
3024 ms808 KiB
#include <bits/stdc++.h> using namespace std; const int N=200005; int a[N],b[N]; int n,k; int main() { scanf("%d %d",&n,&k); for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]); for(int i=0;i<k;i++) { int x; scanf("%d",&x); for(int j=0;j<n;j++) if(a[j]<=x) swap(a[j],b[j]); } long long sum=0; for(int i=0;i<n;i++) sum+=a[i]; cout << sum << endl; }

Compilation message (stderr)

fortune_telling2.cpp: In function 'int main()':
fortune_telling2.cpp:11: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:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
fortune_telling2.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...