Submission #150550

#TimeUsernameProblemLanguageResultExecution timeMemory
150550お前はもう死んでいる (#200)Lokahian Relics (FXCUP4_lokahia)C++17
0 / 100
10 ms696 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();
    }
 
    int sz = 0;
    
    if(s.empty()) s.push_back(la);
    else sz = s[0].size();
    if(s[0].empty()) return -1;

    int res = 0;
    for(auto& x : de){
    	int rrr = CollectRelics(x[0], s[0][0]);
        if(rrr != -1){
        	res = rrr;
            sz += x.size();
        }
    }
    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...