Submission #199834

#TimeUsernameProblemLanguageResultExecution timeMemory
199834mathking1021Memory 2 (JOI16_memory2)C++11
100 / 100
6 ms380 KiB
#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 = n;
        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(ans[t].size() + ve[t].size() > 2) {x = t; break;}
        }
        for(int k = 0; k < n; k++) if(k != x) for(int l = 0; l < ve[k].size(); l++) ans[k].push_back(ve[k][l]);
        if(j == 2 * n)
        {
            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);
        v[i] = true;
        for(j = 0; j < n; j++)
        {
            if(j == x) continue;
            for(int k = 0; k < ve[j].size(); k++)
            {
                v[ve[j][k]] = true;
            }
        }
    }
    for(int i = 0; i < n; i++)
    {
        Answer(ans[i][0], ans[i][1], i);
    }
	return;
}

Compilation message (stderr)

memory2.cpp: In function 'void Solve(int, int)':
memory2.cpp:28:64: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int k = 0; k < n; k++) if(k != x) for(int l = 0; l < ve[k].size(); l++) ans[k].push_back(ve[k][l]);
                                                              ~~^~~~~~~~~~~~~~
memory2.cpp:43:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int k = 0; k < ve[j].size(); k++)
                            ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...