답안 #635838

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
635838 2022-08-27T07:25:19 Z FETT 슈퍼트리 잇기 (IOI20_supertrees) C++14
11 / 100
174 ms 24012 KB
#include "supertrees.h"
#include <bits/stdc++.h>

using namespace std;

int nn;
vector<vector<int>> answer;
int head[1001];



//void c_head()
//{
//    cout<<"head"<<endl;
//    for(int i=0;i<nn;++i)
//    {
//        cout<<head[i]<<" ";
//    }cout<<endl;
//}

int construct(vector<vector<int>> p) {
	nn = p.size();

	for (int i = 0; i < nn; i++) {
        head[i]=i;
		vector<int> row;
		row.resize(nn);
		answer.push_back(row);
	}

	for(int i=0;i<nn;++i)
    {
        if(p[i][0]==-1)continue;
        for(int j=0;j<nn;++j)
        {
            if(p[i][j]==-1)continue;
            if(p[i][j]!=p[j][i])return 0;
            if(p[i][j]==3)return 0;
            if(p[i][j]==1)
            {
                head[j]=i;

                if(i!=j)
                {
                    p[j][0]=-1;
                    answer[i][j]=1;
                    answer[j][i]=1;
                }
            }
        }
    }
//    c_head();
//    cout<<"P"<<endl;
//    for(int i=0;i<nn;++i)
//    {
//        for(int j=0;j<nn;++j)
//        {
//            cout<<p[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    for(int i=0;i<nn;++i)
    {
        bool flag=0;
        if(p[i][0]==-1)continue;
        for(int j=0;j<nn;++j)
        {
            if(p[i][j]==2)
            {
                flag=1;
                p[j][0]=-1;
                answer[head[i]][head[j]]=1;
                answer[head[j]][head[i]]=1;
                head[i]=j;
            }
        }
        if(flag==1)
        {
            answer[i][head[i]]=1;
            answer[head[i]][i]=1;
        }

    }

//    c_head();

	build(answer);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1188 KB Output is correct
7 Correct 158 ms 23940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1188 KB Output is correct
7 Correct 158 ms 23940 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 304 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1212 KB Output is correct
13 Correct 167 ms 23928 KB Output is correct
14 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 43 ms 6164 KB Output is correct
5 Correct 171 ms 24012 KB Output is correct
6 Correct 157 ms 23944 KB Output is correct
7 Correct 165 ms 24012 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 41 ms 6144 KB Output is correct
10 Correct 168 ms 23944 KB Output is correct
11 Correct 165 ms 23932 KB Output is correct
12 Correct 174 ms 23980 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Incorrect 43 ms 6244 KB b[24][24] is not 0
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1188 KB Output is correct
7 Correct 158 ms 23940 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 304 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1212 KB Output is correct
13 Correct 167 ms 23928 KB Output is correct
14 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 7 ms 1188 KB Output is correct
7 Correct 158 ms 23940 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 304 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1212 KB Output is correct
13 Correct 167 ms 23928 KB Output is correct
14 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
15 Halted 0 ms 0 KB -