Submission #1102940

#TimeUsernameProblemLanguageResultExecution timeMemory
1102940KasymKSimple game (IZhO17_game)C++17
22 / 100
1058 ms840 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss secox #define all(v) v.begin(), v.ex() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 1e5+5; int v[N]; int main(){ int n, q; scanf("%d%d", &n, &q); for(int i = 1; i <= n; ++i){ int x; scanf("%d", &x); v[i] = x; } while(q--){ int op; scanf("%d", &op); if(op==1){ int k, u; scanf("%d%d", &k, &u); v[k] = u; continue; } int x, answer = 0; scanf("%d", &x); for(int i = 2; i <= n; ++i) answer += ((v[i]<x and x<v[i-1]) or (v[i]>x and x>v[i-1])); printf("%d\n", answer); } return 0; }

Compilation message (stderr)

game.cpp: In function 'int main()':
game.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
game.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
game.cpp:28:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |         scanf("%d", &op);
      |         ~~~~~^~~~~~~~~~~
game.cpp:31:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |             scanf("%d%d", &k, &u);
      |             ~~~~~^~~~~~~~~~~~~~~~
game.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...