Submission #320991

#TimeUsernameProblemLanguageResultExecution timeMemory
320991techiehere08Pilot (NOI19_pilot)C++14
55 / 100
1101 ms1912 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, m, cnt = 0; scanf("%d%d", &n, &m); int A[n]; long long answer = 0; for(int i = 0; i < n; i++){ scanf("%d", A + i); } for(int j = 0; j < m; j++){ answer = cnt = 0; int x; scanf("%d", &x); for(int i = 0; i < n; i++){ if(A[i] > x){ answer += (cnt * 1ll * (cnt + 1)) / 2; cnt = 0; } else{ cnt++; } } answer += (cnt * 1ll * (cnt + 1)) / 2; printf("%lld\n", answer); } return 0; }

Compilation message (stderr)

pilot.cpp: In function 'int main()':
pilot.cpp:7:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
pilot.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d", A + i);
      |     ~~~~~^~~~~~~~~~~~~
pilot.cpp:15:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   15 |     int x; scanf("%d", &x);
      |            ~~~~~^~~~~~~~~~
#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...
#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...