제출 #1296912

#제출 시각아이디문제언어결과실행 시간메모리
1296912tink8_triRMQ (NOI17_rmq)C++17
0 / 100
16 ms432 KiB
#include <bits/stdc++.h> #define int long long #define pii pair < int, int > #define fi first #define se second const int inf = 1e18; const int maxn = 1e6 + 5; const int offset = 1e6; using namespace std; #define mask(x) (1ll << x) int n, m; struct { int l, r, w; } Q[maxn]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define NAME "test" if (fopen(NAME".INP","r")) { freopen(NAME".INP","r",stdin); freopen(NAME".OUT","w",stdout); } int m; cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> Q[i].l >> Q[i].r >> Q[i].w; } vector < int > v; for (int i = 0; i < n; i++) { v.push_back(i); } do { bool ok = true; for (int i = 1; i <= m; i++) { int l = Q[i].l; int r = Q[i].r; int mn = 1e18; for (int i = l; i <= r; i++) { mn = min(mn, v[i]); } if (mn != Q[i].w) { ok = false; break; } } if (ok) { for (int x : v) cout << x << ' '; return 0; } } while (next_permutation(v.begin(), v.end())); cout << -1; }

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

rmq.cpp: In function 'int main()':
rmq.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen(NAME".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
rmq.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         freopen(NAME".OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...