QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#431495 | #5522. F*** 3-Colorable Graphs | 36champ | RE | 1ms | 3708kb | C++20 | 912b | 2024-06-05 17:27:50 | 2024-06-05 17:27:51 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
//cin >> t;
while(t-->0)
{
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n);
for(int i=0; i<m; i++)
{
int u, v;
cin >> u >> v;
adj[u-1].pb(v-n-1);
}
bool ans = false;
bitset<1000> b[1000];
for(int i=0; i<n; i++)
{
int x = adj[i].size();
for(int j=0; j<x; j++)
{
for(int k=j+1; k<x; k++)
{
ans |= b[adj[i][j]][adj[i][k]];
b[adj[i][j]][adj[i][k]] = 1;
}
}
}
cout << 3 - ans << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3708kb
input:
2 4 1 3 1 4 2 3 2 4
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
3 5 1 4 2 4 2 5 3 5 3 6
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: -100
Runtime Error
input:
10000 20000 4570 11730 8803 16440 4257 15381 4455 17636 5256 13543 2172 18421 7735 17847 8537 16010 6175 12263 1079 13410 335 15901 3272 16233 7435 11454 4469 13374 1564 13416 1264 13446 7484 14510 8193 12267 628 15585 1388 11398 5444 19958 2059 18140 8947 13188 6214 17707 7940 12253 6726 11508 1839...