Submission #1040267

#TimeUsernameProblemLanguageResultExecution timeMemory
1040267guechotjrhhThe Collection Game (BOI21_swaps)C++14
5 / 100
18 ms452 KiB
// // --- Sample implementation for the task swaps --- // // To compile this program with the sample grader, place: // swaps.h swaps_sample.cpp sample_grader.cpp // in a single folder and run: // g++ swaps_sample.cpp sample_grader.cpp // in this folder. // #include "swaps.h" #include<bits/stdc++.h> using namespace std; vector<int> merge_sort(vector<int> v, int n){ if(n==1) return v; vector<int> v1(n/2), v2((n+1)/2); for(int i=0;i<n/2;i++) v1[i]=v[i]; for(int i=n/2;i<n;i++) v2[i-n/2]=v[i]; v1=merge_sort(v1,n/2); v2=merge_sort(v2,(n+1)/2); int p1=0,p2=0,p=0; while(p1<n/2 || p2<(n+1)/2){ if(p1 == n/2){ v[p++]=v2[p2++]; continue; } if(p2 == (n+1)/2){ v[p++]=v1[p1++]; continue; } schedule(v1[p1], v2[p2]); vector<int> a=visit(); if(a[0] == 1) v[p++] = v1[p1++]; else v[p++]=v2[p2++]; } return v; } void solve(int N, int V) { vector<int> v(N); for(int i=0;i<N;i++) v[i]=i+1; v=merge_sort(v,N); answer(v); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...