QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#155137 | #5522. F*** 3-Colorable Graphs | eikki | RE | 0ms | 0kb | C++20 | 803b | 2023-09-01 11:32:33 | 2023-09-01 11:32:34 |
answer
#include <iostream>
#include <vector>
#include <map>
#define maxn 10005
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int n, m;
std::cin >> n >> m;
std::vector<int> adj[maxn]; // ai to bj
for (int i = 0; i < m; i++) {
int u, v;
std::cin >> u >> v;
v -= n;
adj[u].push_back(v);
}
std::vector<int> cherry[maxn];
bool has4 = 0;
for (int i = 1; i <= n; i++) {
for (auto a : adj[i]) {
for (auto b : adj[i]) {
if (a < b) cherry[a][b]++;
if (cherry[a][b] > 1) {
has4 = 1;
std::cout << 2;
return 0;
}
}
}
}
std::cout << 3;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
2 4 1 3 1 4 2 3 2 4