답안 #199658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199658 2020-02-02T13:21:50 Z mathking1021 Memory 2 (JOI16_memory2) C++11
0 / 100
6 ms 256 KB
#include "Memory2_lib.h"
#include <algorithm>
#include <vector>

using namespace std;

int a[105];
bool v[105];
vector<int> ve[105];
vector<int> ans[105];

void Solve(int T, int N)
{
    int n = N;
    for(int i = 0; i < 2 * n; i++)
    {
        int j;
        int x;
        if(v[i]) continue;
        for(j = 0; j < n; j++) ve[j].clear();
        for(j = i + 1; j < 2 * n; j++)
        {
            if(v[j]) continue;
            int t = Flip(i, j);
            ve[t].push_back(j);
            if(ve[t].size() > 2) {x = t;break;}
        }
        if(j == 2 * n)
        {
            for(j = 0; j < n; j++)
            {
                for(int k = 0; k < ve[j].size(); k++)
                {
                    ans[j].push_back(ve[j][k]);
                }
            }
            for(j = 0; j < n; j++)
            {
                if(ans[j].size() != 2) ans[j].push_back(i);
                Answer(ans[j][0], ans[j][1], j);
            }
            return;
        }
        ans[x].push_back(i);
        for(j = 0; j < n; j++)
        {
            if(j == x) continue;
            for(int k = 0; k < ve[j].size(); k++)
            {
                v[ve[j][k]] = true;
                ans[j].push_back(ve[j][k]);
            }
        }
    }
	return;
}

Compilation message

memory2.cpp: In function 'void Solve(int, int)':
memory2.cpp:32:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int k = 0; k < ve[j].size(); k++)
                                ~~^~~~~~~~~~~~~~
memory2.cpp:48:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int k = 0; k < ve[j].size(); k++)
                            ~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Incorrect 5 ms 256 KB Wrong Answer[3]
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -