Submission #368377

# Submission time Handle Problem Language Result Execution time Memory
368377 2021-02-20T01:58:35 Z leinad2 Split the Attractions (IOI19_split) C++17
7 / 100
2000 ms 9068 KB
#include "split.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100010];
int i, j, k, cnt;
vector<int>find_split(int n, int a, int b, int c, vector<int>p, vector<int>q)
{
    vector<int>res(n);
    for(i=0;i<n-1;i++)
    {
        adj[p[i]].push_back(q[i]);
        adj[q[i]].push_back(p[i]);
    }
    for(i=0;i<n;i++)if(adj[i].size()==1)break;
    res[i]=++cnt;
    i=adj[i][0];
    while(1)
    {
        res[i]=++cnt;
        if(adj[i].size()==1)break;
        if(res[adj[i][0]])i=adj[i][1];
        else i=adj[i][0];
    }
    for(i=0;i<n;i++)
    {
        if(res[i]<=a)res[i]=1;
        else if(res[i]<=b+a)res[i]=2;
        else res[i]=3;
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2688 KB ok, correct split
3 Correct 2 ms 2668 KB ok, correct split
4 Correct 3 ms 2668 KB ok, correct split
5 Correct 2 ms 2668 KB ok, correct split
6 Correct 2 ms 2668 KB ok, correct split
7 Correct 84 ms 8940 KB ok, correct split
8 Correct 80 ms 9068 KB ok, correct split
9 Correct 88 ms 8940 KB ok, correct split
10 Correct 81 ms 8940 KB ok, correct split
11 Correct 77 ms 8940 KB ok, correct split
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2668 KB ok, correct split
3 Execution timed out 2075 ms 2668 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2688 KB invalid split: #1=4, #2=1, #3=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2071 ms 2668 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2688 KB ok, correct split
3 Correct 2 ms 2668 KB ok, correct split
4 Correct 3 ms 2668 KB ok, correct split
5 Correct 2 ms 2668 KB ok, correct split
6 Correct 2 ms 2668 KB ok, correct split
7 Correct 84 ms 8940 KB ok, correct split
8 Correct 80 ms 9068 KB ok, correct split
9 Correct 88 ms 8940 KB ok, correct split
10 Correct 81 ms 8940 KB ok, correct split
11 Correct 77 ms 8940 KB ok, correct split
12 Correct 2 ms 2668 KB ok, correct split
13 Correct 2 ms 2668 KB ok, correct split
14 Execution timed out 2075 ms 2668 KB Time limit exceeded
15 Halted 0 ms 0 KB -