QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#210481 | #5364. 面国漫步 | Mine_King | 0 | 0ms | 0kb | C++14 | 1.2kb | 2023-10-11 15:08:56 | 2023-10-11 15:08:57 |
answer
// 願ったんなら叶えてしまえやって
// Think twice, code once.
#include <tuple>
#include <vector>
#include <bitset>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#define eputchar(c) putc(c, stderr)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define eputs(str) fputs(str, stderr), putc('\n', stderr)
using namespace std;
int n, k, q[10005], f[105], vis[105];
long long dis[105];
vector<tuple<int, int, long long>> edge;
int main() {
freopen("meow.in", "r", stdin);
freopen("meow.out", "w", stdout);
scanf("%d%d", &n, &k);
for (int i = 1; i <= k; i++) scanf("%d", &q[i]);
if (q[1] != 1) {puts("YouAreFake!"); return 0;}
for (int i = 1; i <= n; i++) f[q[i]] = i;
for (int i = 1; i <= n; i++) dis[i] = 1ll << 60;
int lst = 1;
for (int i = 2; i <= k; i++) {
if (vis[i]) {puts("YouAreFake!"); return 0;}
vis[i] = 1;
if (f[q[i]] != i) edge.emplace_back(lst, q[i], --dis[q[i]]);
else {
edge.emplace_back(lst, q[i], 0), lst = q[i];
memset(vis, 0, sizeof(vis));
}
}
puts("YouAreWrite!");
printf("%d\n", (int)edge.size());
for (auto i : edge) printf("%d %d %lld\n", get<0>(i), get<1>(i), get<2>(i));
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Dangerous Syscalls
Test #1:
score: 0
Dangerous Syscalls
input:
3 1 1
output:
result:
Subtask #2:
score: 0
Dangerous Syscalls
Test #16:
score: 0
Dangerous Syscalls
input:
85 78 1 46 49 66 12 47 36 28 44 17 48 34 5 82 20 40 69 52 75 27 14 43 53 83 33 55 38 77 58 56 76 81 6 84 19 80 67 3 50 25 26 21 29 62 70 22 68 63 74 37 7 73 78 42 32 2 64 8 39 71 59 18 23 24 9 51 85 11 57 41 45 16 54 30 35 61 72 4
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%