Submission #758073

#TimeUsernameProblemLanguageResultExecution timeMemory
758073vjudge1Simple game (IZhO17_game)C++17
22 / 100
1086 ms700 KiB
#include <bits/stdc++.h> #include <fstream> #define endl '\n' #define mod 1000007 #define INF 1000000000000000000 //#define ll long long ///#define cin fin ///#define cout fout #define fi first #define se second using namespace std; double const EPS = 1e-14; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, m; cin >> n >> m; int arr[n]; for(int i = 0; i < n; i++) cin >> arr[i]; while(m--) { int ty; cin >> ty; if(ty == 1) { int pos, val; cin >> pos >> val; arr[pos-1] = val; } else { int h, ans = 0; cin >> h; bool ok; if(arr[0] < h) ok = false; else ok = true; for(int i = 1; i < n; i++) { if(arr[i] > h && ok == false) { ans++; ok = true; } else if(arr[i] < h && ok == true) { ans++; ok = false; } } cout << ans << endl; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...