QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#252240 | #5522. F*** 3-Colorable Graphs | ucup-team956 | WA | 0ms | 3460kb | C++20 | 996b | 2023-11-15 16:59:48 | 2023-11-15 16:59:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define time chrono::system_clock::now().time_since_epoch().count()
mt19937_64 rnd(time);
#define maxn 1000005
// #define int long long
int read() {int x;cin>>x;return x;}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int n = read(), m = read();
vector f(n + 1, vector(n + 1, (bool)0));
vector<vector<int>>g(n + n + 1);
for(int i = 1; i <= m; i++) {
int aa = read(), bb = read();
g[bb].push_back(aa);
}
for(int i = n + 1; i <= 2 * n; i++) {
for(int j = 0; j < g[i].size(); j++) {
int u = g[i][j];
for(int k = j + 1; k < g[i].size(); k++) {
int v = g[i][k];
f[u][v] = 1;
f[v][u] = 1;
if(f[u][v]) {
cout << "2\n";
return 0;
}
}
}
}
cout << "3\n";
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3376kb
input:
2 4 1 3 1 4 2 3 2 4
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3460kb
input:
3 5 1 4 2 4 2 5 3 5 3 6
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'