QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#270988 | #5160. Kebab Pizza | ckiseki | TL | 1ms | 3520kb | C++20 | 1.5kb | 2023-12-01 19:38:25 | 2023-12-01 19:38:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
#include <experimental/iterator>
void debug_(auto s, auto ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int f = 0;
(..., (cerr << (f++ ? ", " : "") << a));
cerr << ")\e[0m\n";
}
void orange_(auto s, auto L, auto R) {
cerr << "\e[1;33m[ " << s << " ] = [ ";
using namespace experimental;
copy(L, R, make_ostream_joiner(cerr, ", "));
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, k;
cin >> n >> k;
vector<array<int, 2>> a(n);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < 2; ++j)
cin >> a[i][j];
}
sort(a.begin(), a.end());
do {
bool ok = true;
vector<int> c(n);
for (int x = 1; x <= 100; ++x) {
for (int j = 0; j < n; ++j)
c[j] = x == a[j][0] || x == a[j][1];
int cnt = 0;
for (int i = 0; i < n; ++i)
cnt += c[i] == 0 and c[(i + 1) % n] == 1;
if (cnt >= 2) {
ok = false;
}
}
if (ok) {
cout << "possible\n";
for (int i = 0; i < n; ++i)
cerr << a[i][0] << ' ' << a[i][1] << '\n';
return 0;
}
} while (next_permutation(a.begin(), a.end()));
cout << "impossible\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
7 6 2 2 3 6 1 1 1 5 4 5 6 6 6 5
output:
possible
result:
ok single line: 'possible'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
5 5 1 3 1 5 2 3 2 5 3 4
output:
possible
result:
ok single line: 'possible'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
6 7 1 2 2 3 3 4 4 5 3 6 6 7
output:
impossible
result:
ok single line: 'impossible'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
8 4 1 1 1 2 2 1 2 2 3 3 3 4 4 3 4 4
output:
possible
result:
ok single line: 'possible'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
4 4 1 2 2 1 3 4 4 3
output:
possible
result:
ok single line: 'possible'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5 4 1 1 1 4 2 2 2 4 3 4
output:
possible
result:
ok single line: 'possible'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
6 4 1 1 1 4 2 2 2 4 3 3 3 4
output:
impossible
result:
ok single line: 'impossible'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
4 5 1 2 3 4 4 5 5 3
output:
impossible
result:
ok single line: 'impossible'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
4 4 1 1 2 3 3 4 4 2
output:
impossible
result:
ok single line: 'impossible'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
3 4 1 2 2 3 3 1
output:
possible
result:
ok single line: 'possible'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
4 3 1 2 2 3 3 1 1 2
output:
possible
result:
ok single line: 'possible'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
5 4 1 2 2 3 3 1 1 4 4 4
output:
impossible
result:
ok single line: 'impossible'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
4 3 1 2 2 3 3 1 1 1
output:
possible
result:
ok single line: 'possible'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
6 6 1 2 2 3 3 1 4 5 5 6 6 4
output:
impossible
result:
ok single line: 'impossible'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
4 6 1 2 2 3 4 5 5 6
output:
possible
result:
ok single line: 'possible'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
4 8 1 2 3 4 5 6 7 8
output:
possible
result:
ok single line: 'possible'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
3 3 1 2 2 3 1 2
output:
possible
result:
ok single line: 'possible'
Test #18:
score: -100
Time Limit Exceeded
input:
13 11 11 7 8 6 4 8 1 2 6 7 6 2 2 9 3 8 11 8 6 11 8 2 9 1 9 11