QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#575728#5522. F*** 3-Colorable Graphsucup-team3691#RE 0ms0kbC++141.0kb2024-09-19 16:30:132024-09-19 16:30:13

Judging History

你现在查看的是最新测评结果

  • [2024-09-19 16:30:13]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-09-19 16:30:13]
  • 提交

answer

#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <random>
#include <ctime>
#include <cstdlib>
#include <chrono>

using namespace std;

int ap[10001][10001];

void solve() {
  int n, m;
  cin >> n >> m;

  vector<vector<int>> v(2 * n + 1);

  for (int i = 1; i <= m; ++i) {
    int x, y;
    cin >> x >> y;

    v[x].push_back(y + n);
    v[y + n].push_back(x + n);
  }

  for (int x = 1; x <= n; ++x) {
    for (int i = 0; i < v[x].size(); ++i) {
      int n1 = v[x][i];
      for (int j = i + 1; j < v[x].size(); ++j) {
        int n2 = v[x][j];
        if (ap[n1][n2]) {
          cout << 2 << '\n';
          return;
        }
        ap[n1][n2] = 1;
      }
    }
  }

  cout << 3 << "\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  int t = 1;
  // cin >> t;
  while (t--)
    solve();

  return 0;
}

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

output:


result: