Submission #149492

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1494922019-09-01 06:36:00お前はもう死んでいる (#200)Trip to the Galapagos Islands (FXCUP4_island)C++17
100 / 100
3085 ms20600 KiB
#include "island.h"
#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
const int ms = 100100;
int par[ms], when[ms];
std::vector<int> freq[ms];
std::vector< std::pair<int, int> > times[ms];
int getPar(int x) { return par[x] == x ? x : getPar(par[x]); }
int wtf;
void Init(int K, std::vector<int> F, std::vector<int> S, std::vector<int> E){
int N = F.size(), M = S.size();
for(int i = 0; i < N; i++) {
par[i] = i;
when[i] = 1e9;
freq[F[i]].push_back(i);
times[i].emplace_back(F[i], 0);
}
wtf = M;
for(int i = 0; i < M; i++) {
int u = getPar(S[M-i-1]), v = getPar(E[M-i-1]);
if(u == v) continue;
if(times[u].size() > times[v].size()) {
std::swap(u, v);
}
for(int j = 0; j < times[u].size(); j++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

island.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>, std::vector<int>)':
island.cpp:30:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < times[u].size(); j++) {
                  ~~^~~~~~~~~~~~~~~~~
island.cpp: In function 'int Separate(int, int)':
island.cpp:50:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < freq[A].size(); i++) {
                 ~~^~~~~~~~~~~~~~~~
island.cpp:55:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(id < times[u].size() && times[u][id].first == B) {
       ~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...