Submission #849310

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8493102023-09-14 12:35:4042kangarooRope (JOI17_rope)C++17
100 / 100
1990 ms256872 KiB
//
// Created by 42kangaroo on 11/09/2023.
//
#include "bits/stdc++.h"
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, c; cin >> n >> c;
vector<int> colorNum(c);
// count number of each color, and adjacent pairs of odd/even
// put these pairs into a vec<vec<int>>
vector<map<int,int>> adjO(c);
vector<map<int,int>> adjE(c);
int last = -1;
for (int i = 0; i < n; ++i) {
int a; cin >> a;
--a;
colorNum[a]++;
if (last != -1 && last != a) {
if (i%2) {adjO[last][a]++; adjO[a][last]++;}
else {adjE[last][a]++; adjE[a][last]++;}
}
last = a;
}
// and sort it afterwards by num
vector<int> o(c);
std::iota(o.begin(), o.end(),0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...