QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#155119 | #5522. F*** 3-Colorable Graphs | eikki | RE | 0ms | 0kb | C++14 | 644b | 2023-09-01 11:17:40 | 2023-09-01 11:17:42 |
answer
#include <iostream>
#include <vector>
#define maxN 10005
int main() {
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;
}
}
}
if (has4) std::cout << 2;
else 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