| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1296912 | tink8_tri | RMQ (NOI17_rmq) | C++17 | 16 ms | 432 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) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
