QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#210678 | #5364. 面国漫步 | SakuyaBrando | 0 | 0ms | 3748kb | C++14 | 1.9kb | 2023-10-11 18:43:40 | 2023-10-11 18:43:40 |
answer
#include<bits/stdc++.h>
using namespace std;
#define Reimu inline void // 灵梦赛高
#define Marisa inline int // 魔理沙赛高
#define Sanae inline bool // 早苗赛高
#define Reisen inline LL // 铃仙赛高
typedef long long LL;
typedef unsigned long long ULL;
typedef __int128 Suika;
inline ostream &operator<<(ostream &cout, Suika x) {
static const LL LIM = 1e18;
if (x < 0) cout << '-', x = -x;
return x < LIM ? cout << LL(x) : cout << LL(x / LIM) << setw(18) << setfill('0') << LL(x % LIM);
}
typedef pair<int, int> Pii;
typedef tuple<int, int, int> Tiii;
#define fi first
#define se second
#define ALL(vec) vec.begin(), vec.end()
#define TY(type) const type&
#define BT(func) __builtin_##func
#define BTL(func) __builtin_##func##ll
template<typename Ty>
Reimu clear(Ty &x) { Ty().swap(x); }
template<typename Ty>
Reimu max_(Ty &x, TY(Ty) y) { if (y > x) x = y; }
template<typename Ty>
Reimu min_(Ty &x, TY(Ty) y) { if (y < x) x = y; }
const int N = 110;
const LL INF = 1LL << 60;
int n, m, cnt;
int q[N * N], p[N], vis[N], f[N];
LL d[N];
vector<tuple<int, int, LL>> ans;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= m; ++i) cin >> q[i], p[q[i]] = i;
if (p[1] > 1) return cout << "No\n", 0;
for (int i = 1; i <= n; ++i) if (p[i]) f[++cnt] = p[i];
sort(f + 1, f + cnt + 1);
for (int i = 1; i <= n; ++i) d[i] = INF;
LL cur = 0;
for (int i = 1; i < cnt; ++i) {
int l = f[i], r = f[i + 1];
for (int i = l + 1; i <= r; ++i) {
if (vis[q[i]]) return cout << "No\n", 0;
vis[q[i]] = 1;
}
for (int i = l + 1; i < r; ++i) vis[q[i]] = 0, ans.emplace_back(q[l], q[i], --d[q[i]] - cur);
cur += INF - d[q[l]];
ans.emplace_back(q[l], q[r], INF - d[q[l]]);
}
cout << "Yes\n" << ans.size() << '\n';
for (auto [x, y, v]: ans) cout << x << ' ' << y << ' ' << v << '\n';
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3748kb
input:
3 1 1
output:
Yes 0
result:
wrong answer Wrong Answer on the First line of output
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3704kb
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:
Yes 77 1 46 0 46 49 0 49 66 0 66 12 0 12 47 0 47 36 0 36 28 0 28 44 0 44 17 0 17 48 0 48 34 0 34 5 0 5 82 0 82 20 0 20 40 0 40 69 0 69 52 0 52 75 0 75 27 0 27 14 0 14 43 0 43 53 0 53 83 0 83 33 0 33 55 0 55 38 0 38 77 0 77 58 0 58 56 0 56 76 0 76 81 0 81 6 0 6 84 0 84 19 0 19 80 0 80 67 0 67 3 0 3 5...
result:
wrong answer Wrong Answer on the First line of output
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%