QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#140767 | #5160. Kebab Pizza | RetiredButNotTired# | WA | 2ms | 8332kb | C++17 | 700b | 2023-08-16 19:50:21 | 2023-08-16 19:50:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int tt, tc;
const int N = 1e5 + 9, ALPHA = 331;
set<int> adj[N];
void solve() {
int n, k;
cin >> n >> k;
for (int i = 0; i < n; ++i) {
int u, v;
cin >> u >> v;
adj[u].insert(v);
adj[v].insert(u);
}
for (int i = 1; i <= k; ++i) {
int c = 0;
for (auto v: adj[i])
c += adj[v].size() > 1;
if (c > 2) return void(cout << "impossible" << endl);
}
cout << "possible" << endl;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
tt = 1, tc = 1; //cin >> tt;
while (tt--) solve(), tc++;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 8180kb
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: 2ms
memory: 8332kb
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: 8328kb
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: 8272kb
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: 1ms
memory: 8172kb
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: 8112kb
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: 2ms
memory: 8328kb
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: -100
Wrong Answer
time: 1ms
memory: 8276kb
input:
4 5 1 2 3 4 4 5 5 3
output:
possible
result:
wrong answer 1st lines differ - expected: 'impossible', found: 'possible'