답안 #348040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
348040 2021-01-14T04:50:02 Z beksultan04 Split the Attractions (IOI19_split) C++14
18 / 100
127 ms 16492 KB
#include "split.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define lol long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin()Ñ,s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
vector <int> v;
bool vis[100001];
int inex[100001];
vector <int> g[100001];
void dfs(int x,int p){
    vis[x]=1;
    for (int to : g[x]){
        if (to != p && vis[to] == 0)dfs(to,x);
    }
    v.pb(x);
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
	vector<int> res;
	int i,j,s=0;
	for (i=0;i<p.size();++i){
        g[p[i]].pb(q[i]);
        g[q[i]].pb(p[i]);
	}
	for (i=0;i<n;++i){
        if (g[i].size() == 1){
            s = i;
        }
	}
	dfs(s,-1);
	for (i=0;i<v.size();++i){
        if (i < a)inex[v[i]] = 1;
        else if (i < a+b)inex[v[i]] = 2;
        else inex[v[i]]=3;
	}
	for (i=0;i<n;++i){
        res.pb(inex[i]);
	}
	return res;
}

Compilation message

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:39:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for (i=0;i<p.size();++i){
      |           ~^~~~~~~~~
split.cpp:49:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for (i=0;i<v.size();++i){
      |           ~^~~~~~~~~
split.cpp:38:8: warning: unused variable 'j' [-Wunused-variable]
   38 |  int i,j,s=0;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2668 KB ok, correct split
3 Correct 2 ms 2668 KB ok, correct split
4 Correct 2 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 83 ms 15468 KB ok, correct split
8 Correct 93 ms 15212 KB ok, correct split
9 Correct 87 ms 15284 KB ok, correct split
10 Correct 88 ms 15340 KB ok, correct split
11 Correct 85 ms 15212 KB ok, correct split
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2668 KB ok, correct split
3 Correct 2 ms 2668 KB ok, correct split
4 Correct 105 ms 13028 KB ok, correct split
5 Correct 73 ms 9064 KB ok, correct split
6 Correct 89 ms 16492 KB ok, correct split
7 Correct 84 ms 16492 KB ok, correct split
8 Correct 127 ms 13548 KB ok, correct split
9 Correct 79 ms 10220 KB ok, correct split
10 Correct 54 ms 10216 KB ok, correct split
11 Correct 54 ms 10216 KB ok, correct split
12 Correct 57 ms 10600 KB ok, correct split
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Incorrect 72 ms 9136 KB 2 components are not connected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Incorrect 2 ms 2668 KB 2 components are not connected
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2668 KB ok, correct split
2 Correct 2 ms 2668 KB ok, correct split
3 Correct 2 ms 2668 KB ok, correct split
4 Correct 2 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 83 ms 15468 KB ok, correct split
8 Correct 93 ms 15212 KB ok, correct split
9 Correct 87 ms 15284 KB ok, correct split
10 Correct 88 ms 15340 KB ok, correct split
11 Correct 85 ms 15212 KB ok, correct split
12 Correct 2 ms 2668 KB ok, correct split
13 Correct 2 ms 2668 KB ok, correct split
14 Correct 2 ms 2668 KB ok, correct split
15 Correct 105 ms 13028 KB ok, correct split
16 Correct 73 ms 9064 KB ok, correct split
17 Correct 89 ms 16492 KB ok, correct split
18 Correct 84 ms 16492 KB ok, correct split
19 Correct 127 ms 13548 KB ok, correct split
20 Correct 79 ms 10220 KB ok, correct split
21 Correct 54 ms 10216 KB ok, correct split
22 Correct 54 ms 10216 KB ok, correct split
23 Correct 57 ms 10600 KB ok, correct split
24 Correct 2 ms 2668 KB ok, correct split
25 Incorrect 72 ms 9136 KB 2 components are not connected
26 Halted 0 ms 0 KB -