QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#375509 | #2833. Hamilton | Fido_Puppy | WA | 1ms | 3792kb | C++23 | 1.4kb | 2024-04-03 11:41:17 | 2024-04-03 11:41:18 |
Judging History
answer
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define MP make_pair
#define MT make_tuple
#define IT iterator
#define fi first
#define se second
#define For(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define Rep(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)
#define CLR(a, v) memset(a, v, sizeof(a))
#define CPY(a, b) memcpy(a, b, sizeof(a))
#define debug cerr << "ztxakking\n"
#define y0 ztxaknoi
#define y1 ztxakioi
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using vi = vector<int>;
template<typename T>
using V = vector<T>;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e3 + 7;
int n, a[N][N];
vi p;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
while (cin >> n) {
For(i, 1, n) For(j, 1, n) {
char c; cin >> c, a[i][j] = c - 48;
}
p.clear(), p = {1, 2};
For(i, 2, n - 1) {
For(j, 1, i - 1) if (a[p[j]][p[j - 1]] != a[p[j]][p[(j + 1) % i]]) {
p.insert(p.begin() + j - (a[i + 1][p[j]] != a[p[j]][p[j - 1]]), i + 1);
goto skip;
}
p.pb(i + 1);
skip:;
}
for (int u : p) cout << u << ' ';
cout << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
3 001 000 100 4 0000 0000 0000 0000
output:
1 2 3 1 2 3 4
result:
ok 2 cases.
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3792kb
input:
3 000 000 000 3 010 100 000 3 011 100 100 3 011 101 110
output:
1 2 3 1 2 3 1 2 3 1 2 3
result:
wrong answer case #3: found 2 indices