QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#252237#5522. F*** 3-Colorable Graphsucup-team956ML 1ms3376kbC++20991b2023-11-15 16:57:422023-11-15 16:57:43

Judging History

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

  • [2023-11-15 16:57:43]
  • 评测
  • 测评结果:ML
  • 用时:1ms
  • 内存:3376kb
  • [2023-11-15 16:57:42]
  • 提交

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, 0ll));
    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] ++;
                f[v][u] ++;
                if(f[u][v] > 1) {
                    cout << "2\n";
                    return 0;
                }
            }
        }
    }
    cout << "3\n";
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3376kb

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: 1ms
memory: 3376kb

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
Memory Limit Exceeded

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...

output:

3

result: