Submission #142889

#TimeUsernameProblemLanguageResultExecution timeMemory
142889LawlietSimple game (IZhO17_game)C++14
0 / 100
4 ms380 KiB
#include <bits/stdc++.h> #define MAX 1010 using namespace std; int n, m; int n1, n2, n3; int v[MAX]; int main() { scanf("%d %d",&n,&m); for(int g = 1 ; g <= n ; g++) scanf("%d",&v[g]); for(int g = 0 ; g < m ; g++) { scanf("%d %d",&n1,&n2); if(n1 == 1) { scanf("%d",&n3); v[ n2 ] = n3; } else { int ans = 0; for(int h = 2 ; h < n ; h++) { if(v[ h ] > n2 && v[h - 1] < n2) ans++; if(v[ h ] > n2 && v[h + 1] < n2) ans++; } printf("%d\n",ans); } } }

Compilation message (stderr)

game.cpp: In function 'int main()':
game.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
game.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&v[g]);
   ~~~~~^~~~~~~~~~~~
game.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n1,&n2);
   ~~~~~^~~~~~~~~~~~~~~~~
game.cpp:25:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&n3);
    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...