Submission #1268845

#TimeUsernameProblemLanguageResultExecution timeMemory
1268845kawhietSimple game (IZhO17_game)C++20
22 / 100
1095 ms832 KiB
#include <bits/stdc++.h> using namespace std; void fileio(string s) { #ifndef LOCAL freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); #endif } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // fileio("game"); int n, q; cin >> n >> q; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } while (q--) { int t; cin >> t; if (t == 1) { int id, h; cin >> id >> h; id--; a[id] = h; } else { int x; cin >> x; int res = 0; for (int i = 1; i < n; i++) { if (min(a[i], a[i - 1]) <= x && x <= max(a[i], a[i - 1])) { res++; } } cout << res << '\n'; } } return 0; }

Compilation message (stderr)

game.cpp: In function 'void fileio(std::string)':
game.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
game.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...