Submission #150620

#TimeUsernameProblemLanguageResultExecution timeMemory
150620お前はもう死んでいる (#200)Lokahian Relics (FXCUP4_lokahia)C++17
77 / 100
9 ms848 KiB
#include "lokahia.h"
#include <bits/stdc++.h>
using namespace std;


int FindBase(int N){
	vector<vector<int> > s, t, de;
    vector<int> la;
    for(int i = 0; i < N; i++)
            s.push_back({i});
 
    while(s.size() > 1){
        for(int i = 1; i < s.size(); i += 2){
            if(CollectRelics(s[i - 1][0], s[i][0]) == -1){
                de.push_back(s[i - 1]);
                de.push_back(s[i]);
            } else {
                for(int& x : s[i - 1])
                    s[i].push_back(x);
                t.push_back(s[i]);
            }
        }

        if(s.size() & 1){
            de.push_back(s.back());
            la = s.back();
        }

        swap(s, t);
        t.clear();
    }
    
    if(s.empty()) s.push_back(la);
    if(s[0].empty()) return -1;

    int res = 0;
    int root = s[0][0];
    int sz = 1;
    for(int i = 0; i < N; i++){
    	if(root == i) continue;
    	int rrr = CollectRelics(root, i);
    	if(rrr != -1){
    		res = max(rrr, res);
    		sz++;
    	}
    }
    if(sz > N / 2) return res;
    return -1;
}

Compilation message (stderr)

lokahia.cpp: In function 'int FindBase(int)':
lokahia.cpp:13:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < s.size(); i += 2){
                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...