Submission #681589

#TimeUsernameProblemLanguageResultExecution timeMemory
681589drdilyorHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3061 ms7004 KiB
#include <bits/stdc++.h> #ifdef ONPC #include "t_debug.cpp" #else #define debug(...) 42 #endif using namespace std; //namespace pbds = __gnu_pbds; using ll = long long; const int inf = 1e9; const ll infl = 1e18; const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); mt19937 rng(RANDOM); template<typename T, typename U> istream& operator>>(istream& is, pair<T, U>& p) { return is >> p.first >> p.second; } template<typename Cont> int sz(const Cont& cont) { return int(cont.size()); } const string fileio = ""; constexpr int tests = 0, nmax = 2e5, nlog = __lg(nmax), mod = 1e9+7; int solve() { int n, m; cin >> n >> m; if (!cin) return 1; vector<int> arr(n); for (int& i: arr) cin >> i; while (m--) { int l, r, k; cin >> l >> r >> k; vector<int> brr(arr.begin()+l-1, arr.begin() + r); for (int i = 0; i < sz(brr); i++) { for (int j = i+1; j < sz(brr); j++) { if (brr[i] + brr[j] <= k && brr[i] > brr[j]) swap(brr[i], brr[j]); } } cout << is_sorted(brr.begin(), brr.end()) << '\n'; } return 0; } signed main() { int t = 1; #ifdef ONPC t = 10000; #else if (fileio.size()) {freopen((fileio+".in").c_str(),"r",stdin);freopen((fileio+".out").c_str(),"w",stdout);} #endif cin.tie(0)->sync_with_stdio(0); if (tests) cin >> t; while (t-- && cin) { if (solve()) break; #ifdef ONPC cout << "____________________" << endl; #endif } return 0; } /* █████ █████ ███ ████ ▒▒███ ▒▒███ ▒▒▒ ▒▒███ ███████ ████████ ███████ ████ ▒███ █████ ████ ██████ ████████ ███▒▒███ ▒▒███▒▒███ ███▒▒███ ▒▒███ ▒███ ▒▒███ ▒███ ███▒▒███▒▒███▒▒███ ▒███ ▒███ ▒███ ▒▒▒ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒▒ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒████████ █████ ▒▒████████ █████ █████ ▒▒███████ ▒▒██████ █████ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒███ ▒▒▒▒▒▒ ▒▒▒▒▒ ███ ▒███ ▒▒██████ ▒▒▒▒▒▒ */

Compilation message (stderr)

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:47:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |     if (fileio.size()) {freopen((fileio+".in").c_str(),"r",stdin);freopen((fileio+".out").c_str(),"w",stdout);}
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:47:74: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |     if (fileio.size()) {freopen((fileio+".in").c_str(),"r",stdin);freopen((fileio+".out").c_str(),"w",stdout);}
      |                                                                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...