Submission #593291

#TimeUsernameProblemLanguageResultExecution timeMemory
593291LucaGregSimple game (IZhO17_game)C++14
0 / 100
5 ms8020 KiB
#include <bits/stdc++.h> using namespace std; long long int sp[1000010]; int h[1000010]; int main() { int n, m; scanf("%d %d", &n, &m); scanf("%d", &h[0]); for(int i=1;i<n;i++){ scanf("%d", &h[i]); sp[min(h[i-1], h[i])] += 1; sp[max(h[i-1], h[i])+1] -= 1; } for(int i=1;i<1000010;i++){ sp[i] += sp[i-1]; } for(int i=0;i<m;i++){ int t; scanf("%d", &t); if(t==2){ int hq; scanf("%d", &hq); printf("%lld\n", sp[hq]); }else{ int pos, val; scanf("%d %d", &pos, &val); } } return 0; }

Compilation message (stderr)

game.cpp: In function 'int main()':
game.cpp:11:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     int n, m; scanf("%d %d", &n, &m);
      |               ~~~~~^~~~~~~~~~~~~~~~~
game.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &h[0]);
      |     ~~~~~^~~~~~~~~~~~~
game.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%d", &h[i]);
      |         ~~~~~^~~~~~~~~~~~~
game.cpp:22:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         int t; scanf("%d", &t);
      |                ~~~~~^~~~~~~~~~
game.cpp:24:26: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             int hq; scanf("%d", &hq);
      |                     ~~~~~^~~~~~~~~~~
game.cpp:27:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |             int pos, val; scanf("%d %d", &pos, &val);
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...