Submission #1232819

#TimeUsernameProblemLanguageResultExecution timeMemory
1232819_Knyaz_Monkey and Apple-trees (IZhO12_apple)C++20
0 / 100
2096 ms39948 KiB
///Bismillahir Rohmanir Rohim #include <bits/stdc++.h> using namespace std; #define ff first #define sc second #define int int64_t #define ll __uint128_t #define sz(x) long((x).size()) #define all(x) (x).begin(), (x).end() const int mod = 1e9+7; const double PI = acos( -1. ); void in(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } void solve(){ int M, C = 0; cin >> M; unordered_set<int> ripened; for(int i = 0; i < M; i++){ int D, X, Y; cin >> D >> X >> Y; int L = X + C, R = Y + C; if(D == 2){ for(int j = L; j <= R; j++) ripened.insert(j); } else{ int cnt = 0; for(int j = L; j <= R; j++) cnt += ripened.count(j); C = cnt; cout << C << '\n'; } } } signed main(){ //in(); cin.tie(0)->sync_with_stdio(0); int t; t = 1; //cin >> t; while(t--) solve(); } /* ██╗ ██╗███╗ ██╗██╗ ██╗ █████╗ ███████╗ ██║ ██╔╝████╗ ██║╚██╗ ██╔╝██╔══██╗╚══███╔╝ █████╔╝ ██╔██╗ ██║ ╚████╔╝ ███████║ ███╔╝ ██╔═██╗ ██║╚██╗██║ ╚██╔╝ ██╔══██║ ███╔╝ ███████╗██║ ██╗██║ ╚████║ ██║ ██║ ██║███████╗███████╗ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ */

Compilation message (stderr)

apple.cpp: In function 'void in()':
apple.cpp:13:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     freopen("input.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
apple.cpp:14:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     freopen("output.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...