제출 #681590

#제출 시각아이디문제언어결과실행 시간메모리
681590drdilyorHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
8 / 100
3086 ms6280 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); debug(brr); for (int i = sz(brr)-1; i >= 1; i--) { for (int j = 0; j < i; j++) { if (brr[j] + brr[j+1] <= k && brr[j] > brr[j+1]) swap(brr[j], brr[j+1]); } } debug(brr); 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; } /* █████ █████ ███ ████ ▒▒███ ▒▒███ ▒▒▒ ▒▒███ ███████ ████████ ███████ ████ ▒███ █████ ████ ██████ ████████ ███▒▒███ ▒▒███▒▒███ ███▒▒███ ▒▒███ ▒███ ▒▒███ ▒███ ███▒▒███▒▒███▒▒███ ▒███ ▒███ ▒███ ▒▒▒ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒▒ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒███ ▒▒████████ █████ ▒▒████████ █████ █████ ▒▒███████ ▒▒██████ █████ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒███ ▒▒▒▒▒▒ ▒▒▒▒▒ ███ ▒███ ▒▒██████ ▒▒▒▒▒▒ */

컴파일 시 표준 에러 (stderr) 메시지

sortbooks.cpp: In function 'int solve()':
sortbooks.cpp:5:24: warning: statement has no effect [-Wunused-value]
    5 |     #define debug(...) 42
      |                        ^~
sortbooks.cpp:30:9: note: in expansion of macro 'debug'
   30 |         debug(brr);
      |         ^~~~~
sortbooks.cpp:5:24: warning: statement has no effect [-Wunused-value]
    5 |     #define debug(...) 42
      |                        ^~
sortbooks.cpp:37:9: note: in expansion of macro 'debug'
   37 |         debug(brr);
      |         ^~~~~
sortbooks.cpp: In function 'int main()':
sortbooks.cpp:49:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     if (fileio.size()) {freopen((fileio+".in").c_str(),"r",stdin);freopen((fileio+".out").c_str(),"w",stdout);}
      |                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:49:74: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |     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...