# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
283918 | 2020-08-26T09:35:53 Z | Nodir_Bobiev | Split the Attractions (IOI19_split) | C++17 | 128 ms | 12792 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; bool sub1 = true, sub2 = true, sub3 = true, sub4 = true; int n, m, A, B, C; vector < int > gr[N]; vector < int > Subtask1(){ vector < int > ans(n,0); int fath = -1, start = 0; for( int i = 0; i < n; i ++ ){ if( gr[i].size() == 1 )start = i; } while( A + B + C > 0 ){ if( A > 0 ){ ans[start] = 1; A--; }else if( B > 0 ){ ans[start] = 2; B --; }else{ ans[start] = 3; C --; } if( gr[start][0] != fath ){ fath = start; start = gr[start][0]; }else if( gr[start].size() > 1 ){ fath = start; start = gr[start][1]; } }return ans; } vector < int > Subtask2(){ vector < int > ans(n, 3); queue < int > q; q.push(0); while(!q.empty() && B > 0){ int v = q.front();q.pop(); ans[v] = 2; B--; for( auto to: gr[v] ){ if( ans[to] == 3 ) q.push(to); } }for( int i = 0; i < n; i ++ )if( ans[i] == 3 ){ans[i]=1;break;} return ans; } vector < int > Subtask3(){ return {}; } vector < int > Subtask4(){ return {}; } vector<int> find_split(int nn, int aa, int bb, int cc, vector<int> pp, vector<int> qq) { n = nn; m = pp.size(); A = aa; B = bb; C = cc; if( m >= n )sub3 = false; if( n > 2500 || m > 5000 ) sub4 = false; if( A > 1 ) sub2 = false; for( int i = 0; i < m; i ++ ){ gr[pp[i]].push_back(qq[i]); gr[qq[i]].push_back(pp[i]); } for( int i = 0; i < n; i ++ ){ if( gr[i].size() > 2 )sub1 = false; } if( sub1 ){ return Subtask1(); } if( sub2 ){ return Subtask2(); } if( sub3 ){ return Subtask3(); } if( sub4 ){ return Subtask4(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | ok, correct split |
2 | Correct | 2 ms | 2688 KB | ok, correct split |
3 | Correct | 2 ms | 2688 KB | ok, correct split |
4 | Correct | 3 ms | 2688 KB | ok, correct split |
5 | Correct | 3 ms | 2688 KB | ok, correct split |
6 | Correct | 2 ms | 2688 KB | ok, correct split |
7 | Correct | 112 ms | 7800 KB | ok, correct split |
8 | Correct | 110 ms | 7800 KB | ok, correct split |
9 | Correct | 106 ms | 7684 KB | ok, correct split |
10 | Correct | 117 ms | 7800 KB | ok, correct split |
11 | Correct | 106 ms | 7800 KB | ok, correct split |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | ok, correct split |
2 | Correct | 2 ms | 2688 KB | ok, correct split |
3 | Correct | 2 ms | 2688 KB | ok, correct split |
4 | Correct | 118 ms | 10616 KB | ok, correct split |
5 | Correct | 106 ms | 9112 KB | ok, correct split |
6 | Correct | 125 ms | 8980 KB | ok, correct split |
7 | Correct | 98 ms | 8888 KB | ok, correct split |
8 | Incorrect | 128 ms | 12792 KB | invalid split: #1=1, #2=8004, #3=91995 |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2688 KB | WA in grader: Invalid length of the result. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2688 KB | WA in grader: Invalid length of the result. |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | ok, correct split |
2 | Correct | 2 ms | 2688 KB | ok, correct split |
3 | Correct | 2 ms | 2688 KB | ok, correct split |
4 | Correct | 3 ms | 2688 KB | ok, correct split |
5 | Correct | 3 ms | 2688 KB | ok, correct split |
6 | Correct | 2 ms | 2688 KB | ok, correct split |
7 | Correct | 112 ms | 7800 KB | ok, correct split |
8 | Correct | 110 ms | 7800 KB | ok, correct split |
9 | Correct | 106 ms | 7684 KB | ok, correct split |
10 | Correct | 117 ms | 7800 KB | ok, correct split |
11 | Correct | 106 ms | 7800 KB | ok, correct split |
12 | Correct | 2 ms | 2688 KB | ok, correct split |
13 | Correct | 2 ms | 2688 KB | ok, correct split |
14 | Correct | 2 ms | 2688 KB | ok, correct split |
15 | Correct | 118 ms | 10616 KB | ok, correct split |
16 | Correct | 106 ms | 9112 KB | ok, correct split |
17 | Correct | 125 ms | 8980 KB | ok, correct split |
18 | Correct | 98 ms | 8888 KB | ok, correct split |
19 | Incorrect | 128 ms | 12792 KB | invalid split: #1=1, #2=8004, #3=91995 |
20 | Halted | 0 ms | 0 KB | - |