| Task: | Terrible security |
| Sender: | aalto26fm_003 |
| Submission time: | 2026-10-05 16:33:35 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 0.00 s | details |
| #3 | ACCEPTED | 0.00 s | details |
| #4 | ACCEPTED | 0.00 s | details |
| #5 | ACCEPTED | 0.00 s | details |
| #6 | ACCEPTED | 0.00 s | details |
| #7 | ACCEPTED | 0.00 s | details |
| #8 | ACCEPTED | 0.00 s | details |
| #9 | ACCEPTED | 0.00 s | details |
| #10 | ACCEPTED | 0.00 s | details |
| #11 | ACCEPTED | 0.00 s | details |
| #12 | ACCEPTED | 0.00 s | details |
| #13 | ACCEPTED | 0.00 s | details |
| #14 | ACCEPTED | 0.00 s | details |
| #15 | ACCEPTED | 0.00 s | details |
| #16 | ACCEPTED | 0.00 s | details |
| #17 | ACCEPTED | 0.00 s | details |
| #18 | ACCEPTED | 0.00 s | details |
| #19 | ACCEPTED | 0.00 s | details |
| #20 | ACCEPTED | 0.00 s | details |
| #21 | ACCEPTED | 0.00 s | details |
| #22 | ACCEPTED | 0.00 s | details |
| #23 | ACCEPTED | 0.00 s | details |
| #24 | ACCEPTED | 0.00 s | details |
| #25 | ACCEPTED | 0.00 s | details |
| #26 | ACCEPTED | 0.00 s | details |
| #27 | ACCEPTED | 0.00 s | details |
| #28 | ACCEPTED | 0.00 s | details |
| #29 | ACCEPTED | 0.00 s | details |
| #30 | ACCEPTED | 0.00 s | details |
| #31 | ACCEPTED | 0.00 s | details |
| #32 | ACCEPTED | 0.00 s | details |
| #33 | ACCEPTED | 0.00 s | details |
| #34 | ACCEPTED | 0.00 s | details |
| #35 | ACCEPTED | 0.00 s | details |
| #36 | ACCEPTED | 0.00 s | details |
| #37 | ACCEPTED | 0.00 s | details |
| #38 | ACCEPTED | 0.00 s | details |
| #39 | ACCEPTED | 0.00 s | details |
| #40 | ACCEPTED | 0.00 s | details |
| #41 | ACCEPTED | 0.00 s | details |
| #42 | ACCEPTED | 0.00 s | details |
| #43 | ACCEPTED | 0.00 s | details |
| #44 | ACCEPTED | 0.00 s | details |
| #45 | ACCEPTED | 0.00 s | details |
| #46 | ACCEPTED | 0.00 s | details |
| #47 | ACCEPTED | 0.00 s | details |
| #48 | ACCEPTED | 0.00 s | details |
| #49 | ACCEPTED | 0.00 s | details |
| #50 | ACCEPTED | 0.00 s | details |
| #51 | ACCEPTED | 0.00 s | details |
| #52 | ACCEPTED | 0.00 s | details |
| #53 | ACCEPTED | 0.00 s | details |
| #54 | ACCEPTED | 0.00 s | details |
| #55 | ACCEPTED | 0.01 s | details |
| #56 | ACCEPTED | 0.00 s | details |
| #57 | ACCEPTED | 0.01 s | details |
| #58 | ACCEPTED | 0.01 s | details |
| #59 | ACCEPTED | 0.01 s | details |
| #60 | ACCEPTED | 0.00 s | details |
| #61 | ACCEPTED | 0.01 s | details |
| #62 | ACCEPTED | 0.00 s | details |
| #63 | ACCEPTED | 0.01 s | details |
| #64 | ACCEPTED | 0.00 s | details |
| #65 | ACCEPTED | 0.05 s | details |
| #66 | ACCEPTED | 0.08 s | details |
| #67 | ACCEPTED | 0.11 s | details |
| #68 | ACCEPTED | 0.08 s | details |
| #69 | ACCEPTED | 0.08 s | details |
| #70 | ACCEPTED | 0.09 s | details |
| #71 | ACCEPTED | 0.07 s | details |
| #72 | ACCEPTED | 0.08 s | details |
| #73 | ACCEPTED | 0.07 s | details |
| #74 | ACCEPTED | 0.04 s | details |
Code
#include <iostream>
#include <vector>
#include <functional>
#include <set>
#include <algorithm>
#include <stack>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <limits>
#include <queue>
typedef long long Int;
std::tuple<Int> readInt1(){
Int a;
std::cin >> a;
return {a};
}
std::tuple<Int,Int> readInt2(){
Int a, b;
std::cin >> a >> b;
return {a,b};
}
std::tuple<Int,Int,Int> readInt3(){
Int a, b, c;
std::cin >> a >> b >> c;
return {a,b,c};
}
std::vector<Int> readVecInt(Int n){
std::vector<Int> arr(n);
for (Int i = 0; i < n; i++){
Int a;
std::cin >> a;
arr[i] = a;
}
return arr;
}
std::vector<std::string> readVecStr(Int n){
std::vector<std::string> arr(n);
for (Int i = 0; i < n; i++){
std::string a;
std::cin >> a;
arr[i] = a;
}
return arr;
}
std::vector<long long> readVecLong(Int n){
std::vector<long long> arr(n);
for (Int i = 0; i < n; i++){
long long a;
std::cin >> a;
arr[i] = a;
}
return arr;
}
std::vector<std::tuple<Int,Int>> readVecTup2(Int n){
std::vector<std::tuple<Int,Int>> arr(n);
for (Int i = 0; i < n; i++){
Int a, b;
std::cin >> a;
std::cin >> b;
arr[i] = {a,b};
}
return arr;
}
std::vector<std::tuple<Int,Int,Int>> readVecTup3(Int n){
std::vector<std::tuple<Int,Int,Int>> arr(n);
for (Int i = 0; i < n; i++){
Int a, b, c;
std::cin >> a;
std::cin >> b;
std::cin >> c;
arr[i] = {a,b,c};
}
return arr;
}
std::vector<std::tuple<Int,Int,Int,Int>> readVecTup4(Int n){
std::vector<std::tuple<Int,Int,Int,Int>> arr(n);
for (Int i = 0; i < n; i++){
Int a, b, c,d;
std::cin >> a;
std::cin >> b;
std::cin >> c;
std::cin >> d;
arr[i] = {a,b,c,d};
}
return arr;
}
void printNewLine(){std::cout << "\n";}
template<typename T, typename... Ts>
std::tuple<Ts...> tail(std::tuple<T,Ts...> as){
return std::apply([](T &a, Ts... b){return std::make_tuple(b...);},as);
}
template<typename T>
void print(T a){std::cout << std::setprecision(19) << a;}
template<typename... T>
void println(T... a);
template<typename T, typename Ts>
void print(std::tuple<T,Ts> a){
print(std::get<0>(a));
print(" ");
print(std::get<1>(a));
}
template<typename T, typename... Ts>
void print(std::tuple<T,Ts...> a){
print(std::get<0>(a));
print(" ");
print(tail(a));
}
template<typename T>
void print(const std::vector<T> &arr, Int width = -1){
if (width == -1) width = arr.size();
for (Int i = 0; i < (Int)arr.size(); i++){
print(arr[i]);
if (i+1 == (Int)arr.size()) continue;
if ((i%width) == width-1) printNewLine();
if ((i%width) != width-1) print(" ");
}
}
template<typename... T>
void println(T... a){print(a...);printNewLine();}
template<typename T>
void sorted(std::vector<T> &arr){
std::sort(arr.begin(),arr.end(),[](const T &a, const T &b){ return a < b; });
}
template<typename T>
std::set<T> toSet(const std::vector<T> &vec){
std::set<T> c;
for (T a : vec){ c.emplace(a);}
return c;
}
template<typename T, typename N>
std::vector<N> map(const std::vector<T> &a, const std::function<N(T)> &transform){
std::vector<N> b(a.size());
Int i = 0;
for (T x : a){
b[i] = transform(x);
i++;
}
return b;
}
template<typename N, typename M, typename R>
std::vector<R> zip(const std::vector<N> &a, const std::vector<M> &b, const std::function<R(N,M)> &transform){
Int n = std::min(a.size(),b.size());
std::vector<R> res(n);
for (Int i = 0; i < n; i++){
res[i] = transform(a[i],b[i]);
}
return res;
}
template<typename T, typename N>
std::vector<N> convertVec(const std::vector<T> &a){
std::vector<N> b(a.size());
Int i = 0;
for (T x : a){
b[i] = x;
i++;
}
return b;
}
template<typename T>
std::vector<T> reverse(const std::vector<T> &a){
std::vector<T> b(a.size());
Int i = 0;
for (T x : a){
b[a.size()-1-i] = x;
i++;
}
return b;
}
template<typename T, typename R>
R reduce(const std::vector<T> &arr, R init, const std::function<R(const R,const T)> &transform){
R current = init;
for (Int idx = 0; idx < (Int)arr.size(); idx++){
current = transform(current,arr[idx]);
};
return current;
}
template<typename T>
T max(const std::vector<T> &arr){return reduce(arr, arr[0], static_cast<std::function<T(const T,const T)>>(static_cast<const T& (*)(const T&, const T&)>(std::max<T>)));}
template<typename T>
T min(const std::vector<T> &arr){return reduce(arr, arr[0], static_cast<std::function<T(const T,const T)>>(static_cast<const T& (*)(const T&, const T&)>(std::min<T>)));}
template<typename T>
std::function<T(const T,const T)> add(){return [](T a,T b){return a+b;};}
template<typename T>
std::function<T(const T,const T)> modAdd(T mod){return [mod](T a,T b){return (((a+b)%mod)+mod)%mod;};}
template<typename T, typename R>
std::function<R(const R,const T)> mulAdd(R mul){return [mul](R a,T b){return a+b*mul;};}
template<typename T>
T sum(const std::vector<T> &arr){return reduce(arr, 0, add<T>());}
template<typename T>
T avg(const std::vector<T> &arr){return reduce(arr, 0.0, mulAdd<double,T>(1.0/arr.size()));}
template<typename T>
T binarySearch(T min, T max, const std::function<bool(T)> &leq){
if (min == max) return max;
T guess = (min+max)/2;
if (leq(guess)){
return binarySearch(min,guess,leq);
}else{
return binarySearch(guess+1,max,leq);
}
}
template<typename T>
T binarySearchDecending(T min, T max, const std::function<bool(T)> &leq){
std::function<bool(T)> gt = [leq](T x){
return !leq(x);
};
return binarySearch(min,max+1, gt)-1;
}
template<typename T>
std::vector<T> cloneVec(std::vector<T> a){return a;}
template<typename T>
std::vector<T> padding(const std::vector<T> &initial, T num, Int start, Int end){
std::vector<T> arr(start+initial.size()+end);
for (Int i = 0; i < start; i++){
arr[i] = num;
}
for (Int i = 0; i < (Int)initial.size(); i++){
arr[start+i] = initial[i];
}
for (Int i = 0; i < end; i++){
arr[start+initial.size()+i] = num;
}
return arr;
}
template<typename T>
Int findMax(Int start, Int end, const std::function<T(Int)> &maxHeuristic){
T initialGuess = maxHeuristic(start);
Int index = start;
for (Int i = start; i <= end; i++){
if (initialGuess < maxHeuristic(i)){
initialGuess = maxHeuristic(i);
index = i;
}
}
return index;
}
template<typename T>
void operateOnMax(Int start, Int end, const std::function<T(Int)> &maxHeuristic, const std::function<void(Int)> &found){
found(findMax(start,end,maxHeuristic));
}
template<typename T>
void stackOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
std::stack<T> stack;
for (auto x : init){
stack.push(x);
}
while (!stack.empty()){
T next = stack.top();
stack.pop();
std::vector<T> nextSteps = operate(next);
for (T a : nextSteps){
stack.push(a);
}
}
}
template<typename T>
void queueOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
std::queue<T> que;
for (auto x : init){
que.push(x);
}
while (!que.empty()){
T next = que.front();
que.pop();
std::vector<T> nextSteps = operate(next);
for (T a : nextSteps){
que.push(a);
}
}
}
template<typename T>
void priorityQueueOperate(std::vector<T> init, const std::function<std::vector<T>(T)> operate){
std::priority_queue<T> que;
for (auto x : init){
que.push(x);
}
while (!que.empty()){
T next = que.top();
que.pop();
std::vector<T> nextSteps = operate(next);
for (T a : nextSteps){
que.push(a);
}
}
}
template<typename T>
void recursiveVectorSplit(Int start, Int end, Int distl, Int distr, const std::function<T(Int)> &maxHeuristic, const std::function<void(Int)> &found){
if (start == end){
return found(start);
}else if (end < start){
return;
}
std::tuple<Int,Int> range = {start,end};
std::function<std::vector<std::tuple<Int,Int>>(std::tuple<Int,Int>)> splitter = [distl, distr,&maxHeuristic,&found](std::tuple<Int,Int> range){
auto [start,end] = range;
Int idx = findMax(start, end, maxHeuristic);
found(idx);
std::vector<std::tuple<Int,Int>> next;
if (idx+distl+1 <= end){
next.push_back({idx+distl+1,end});
}
if (start <= idx-distr-1){
next.push_back({start, idx-distr-1});
}
return next;
};
stackOperate({range},splitter);
}
template<typename T>
std::vector<T> dynamicallyComputableList(Int n, std::function<T(std::vector<T>&,Int)> next){
std::vector<T> arr(n);
for (Int i = 0; i < n; i++){
arr[i] = next(arr,i);
}
return arr;
}
template<typename T>
Int indexOfBinarySearch(const std::vector<T> &arr, const T &find){
return binarySearch((Int)0,(Int)arr.size()-1,(std::function<bool(Int)>)[&arr, &find](Int guess){return find <= arr[guess];});
}
template<typename T>
std::unordered_map<T, Int> indexCompress(const std::vector<T> &arr){
std::unordered_map<T, Int> compressed;
Int i = 0;
for (T x : arr){
if (compressed.find(x) != compressed.end()) compressed[x] = i++;
}
return compressed;
}
template<typename... Ts>
std::tuple<std::vector<std::tuple<Int,Ts...>>, std::vector<Int>> edgeIndexing(int n, std::vector<std::tuple<Int,Ts...>> edges){
sorted(edges);
std::vector<Int> edgeIndex(n+1);
{
Int j = 0;
for (Int i = 0; i < (Int)edges.size(); i++) {
auto a = std::get<0>(edges[i]);
while (j <= a){
edgeIndex[j++] = i;
}
}
while (j < n){
edgeIndex[j++] = edges.size();
}
edgeIndex[n] = edges.size();
}
return {edges,edgeIndex};
}
template<typename T>
std::tuple<std::vector<T>, std::vector<Int>> shortestPath(std::vector<std::tuple<Int, Int, T>> &edgesMessy, Int start){
std::vector<std::tuple<Int, Int, T>> edges = edgesMessy;
for (auto e : edgesMessy){
auto [a,b,t] = e;
edges.push_back({b,a,t});
}
shortestPathDirected(edges, start);
}
template<typename T>
std::tuple<std::vector<T>, std::vector<Int>> shortestPathDirected(const Int n, std::vector<std::tuple<Int, Int, T>> &edges, Int start){
//assumes all paths are between 0 <= c < n
//assumes 0 indexing
std::vector<Int> path(n);
std::vector<bool> edgeUpdated(n);
std::vector<T> distance(n);
for (Int i = 0; i < n; i++) path[i] = i;
for (Int i = 0; i < n; i++) edgeUpdated[i] = true;
edgeUpdated[start] = false;
for (Int i = 0; i < n; i++) distance[i] = std::numeric_limits<T>::max()/4;
distance[start] = 0;
sorted(edges);
std::vector<Int> edgeIndex(n+1);
{
Int j = 0;
for (Int i = 0; i < (Int)edges.size(); i++) {
auto& [a,b,w] = edges[i];
while (j <= a){
edgeIndex[j++] = i;
}
}
while (j < n){
edgeIndex[j++] = edges.size();
}
edgeIndex[n] = edges.size();
}
std::function<std::vector<std::tuple<Int,Int>>(std::tuple<Int,Int>)> func = [&distance,&edgeIndex,&edges,&path,&edgeUpdated](std::tuple<Int,Int> propagateW){
auto& [weight,propagate] = propagateW;
std::vector<std::tuple<Int,Int>> next;
if (distance[propagate] != -weight) return next;
if (edgeUpdated[propagate]) return next;
for (Int i = edgeIndex[propagate]; i < edgeIndex[propagate+1]; i++){
auto& [a, b, w] = edges[i];
if (distance[a]+w < distance[b]){
next.push_back({-(distance[a]+w),b});
distance[b] = distance[a]+w;
path[b] = a;
edgeUpdated[b] = false;
}
}
edgeUpdated[propagate] = true;
return next;
};
priorityQueueOperate((std::vector<std::tuple<Int,Int>>){{0,start}},func);
//for (Int i = 0; i < n; i++) {
// bool changed = false;
// for (auto& e : edges) {
// auto& [a, b, w] = e;
// if (!changed) {changed = (distance[b] != std::min(distance[b], distance[a]+w));}
// if (distance[a]+w < distance[b]){
// distance[b] = distance[a]+w;
// path[b] = a;
// }
// }
// if (!changed) break;
// if (changed && i == n){
// return std::tuple((std::vector<T>){},(std::vector<Int>){});
// }
//}
return std::tuple(distance,path);
}
std::vector<Int> pathFromPathMap(std::vector<Int> &map, Int goal){
std::stack<Int> fullPath;
fullPath.push(goal);
while (map[fullPath.top()] != fullPath.top()){
fullPath.push(map[fullPath.top()]);
}
std::vector<Int> p;
while (!fullPath.empty()){
p.push_back(fullPath.top());
fullPath.pop();
}
return p;
}
template<typename T>
std::vector<T> distanceTable(const std::vector<T> &init, const std::function<T(T,T)> &distance){
Int n = init.size();
std::vector<T> table(n*n);
for (Int i = 0; i < n; i++){
table[i+n*i] = init[i];
for (Int j = i-1; j >= 0; j--){
table[j+n*i] = distance(init[j],table[j+1+n*i]);
}
for (Int j = i+1; j < n; j++){
table[j+n*i] = distance(table[j-1+n*i],init[j]);
}
}
return table;
}
void particles(){
auto [n] = readInt1();
auto arr = readVecLong(n);
std::vector<long long> table = distanceTable(arr,add<long long>());
print(table,n);
//println(cost[n*n-1]);
}
template<typename T>
std::vector<T> range(const std::vector<T> &a, Int from, Int to){
std::vector<T> b;
for (Int i = from; i < to; i++){
b.push_back(a[i]);
}
return b;
}
template<typename T>
bool forall(const std::vector<T> &a, std::function<bool(T)> &test){
bool res = true;
for (auto v : a){
res = res & test(v);
}
return res;
}
std::string modRepresentation(Int n, Int mod){
return "("+std::to_string(n%mod)+","+std::to_string(n/mod)+")";
}
int main() {
auto [n,q] = readInt2();
auto arr = readVecInt(n);
auto resQ = readVecInt(q);
for (auto& a : arr) a -= 1;
for (auto& a : resQ) a -= 1;
std::vector<Int> loopSize(n,-1);
for (Int i = 0; i < n; i++){
if (loopSize[i] != -1) continue;
Int next = arr[i];
Int c = 1;
while (next != i){
c++;
next = arr[next];
}
next = arr[next];
loopSize[i] = c;
while (next != i){
loopSize[next] = c;
next = arr[next];
}
}
for (auto& a : resQ) a = loopSize[a];
println(resQ);
return 0;
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 1 1 1 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 2 2 2 1 1 1 |
| correct output |
|---|
| 2 2 |
| user output |
|---|
| 2 2 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 2 1 1 2 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 3 1 2 1 3 3 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 3 1 2 1 3 2 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 3 3 1 2 3 2 3 3 |
| correct output |
|---|
| 1 1 1 |
| user output |
|---|
| 1 1 1 |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 3 1 1 2 3 3 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 3 2 1 3 2 3 1 |
| correct output |
|---|
| 2 1 |
| user output |
|---|
| 2 1 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 4 3 1 2 4 3 1 1 3 |
| correct output |
|---|
| 1 1 2 |
| user output |
|---|
| 1 1 2 |
Test 10
Verdict: ACCEPTED
| input |
|---|
| 4 3 2 3 1 4 1 2 2 |
| correct output |
|---|
| 3 3 3 |
| user output |
|---|
| 3 3 3 |
Test 11
Verdict: ACCEPTED
| input |
|---|
| 4 3 1 2 3 4 4 1 3 |
| correct output |
|---|
| 1 1 1 |
| user output |
|---|
| 1 1 1 |
Test 12
Verdict: ACCEPTED
| input |
|---|
| 4 1 3 4 1 2 1 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 13
Verdict: ACCEPTED
| input |
|---|
| 4 4 2 1 3 4 3 4 1 1 |
| correct output |
|---|
| 1 1 2 2 |
| user output |
|---|
| 1 1 2 2 |
Test 14
Verdict: ACCEPTED
| input |
|---|
| 4 3 2 1 3 4 2 1 1 |
| correct output |
|---|
| 2 2 2 |
| user output |
|---|
| 2 2 2 |
Test 15
Verdict: ACCEPTED
| input |
|---|
| 5 5 1 3 2 4 5 3 5 3 4 4 |
| correct output |
|---|
| 2 1 2 1 1 |
| user output |
|---|
| 2 1 2 1 1 |
Test 16
Verdict: ACCEPTED
| input |
|---|
| 5 1 1 3 2 5 4 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 17
Verdict: ACCEPTED
| input |
|---|
| 5 5 1 2 5 4 3 3 3 3 2 2 |
| correct output |
|---|
| 2 2 2 1 1 |
| user output |
|---|
| 2 2 2 1 1 |
Test 18
Verdict: ACCEPTED
| input |
|---|
| 5 1 1 2 3 4 5 3 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 19
Verdict: ACCEPTED
| input |
|---|
| 5 5 3 4 5 1 2 3 1 5 5 4 |
| correct output |
|---|
| 5 5 5 5 5 |
| user output |
|---|
| 5 5 5 5 5 |
Test 20
Verdict: ACCEPTED
| input |
|---|
| 5 2 1 4 3 5 2 5 5 |
| correct output |
|---|
| 3 3 |
| user output |
|---|
| 3 3 |
Test 21
Verdict: ACCEPTED
| input |
|---|
| 5 2 1 5 3 2 4 5 1 |
| correct output |
|---|
| 3 1 |
| user output |
|---|
| 3 1 |
Test 22
Verdict: ACCEPTED
| input |
|---|
| 5 4 1 2 3 4 5 3 5 2 3 |
| correct output |
|---|
| 1 1 1 1 |
| user output |
|---|
| 1 1 1 1 |
Test 23
Verdict: ACCEPTED
| input |
|---|
| 5 2 3 1 2 4 5 5 2 |
| correct output |
|---|
| 1 3 |
| user output |
|---|
| 1 3 |
Test 24
Verdict: ACCEPTED
| input |
|---|
| 5 1 1 2 4 3 5 2 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 25
Verdict: ACCEPTED
| input |
|---|
| 10 5 6 2 4 5 3 1 7 8 10 9 7 7 4 5 3 |
| correct output |
|---|
| 1 1 3 3 3 |
| user output |
|---|
| 1 1 3 3 3 |
Test 26
Verdict: ACCEPTED
| input |
|---|
| 10 10 7 2 9 4 1 5 6 10 3 8 2 3 1 4 2 4 4 7 4 10 |
| correct output |
|---|
| 1 2 4 1 1 1 1 4 1 2 |
| user output |
|---|
| 1 2 4 1 1 1 1 4 1 2 |
Test 27
Verdict: ACCEPTED
| input |
|---|
| 10 5 2 1 3 8 7 10 5 4 6 9 4 4 2 3 7 |
| correct output |
|---|
| 2 2 2 1 2 |
| user output |
|---|
| 2 2 2 1 2 |
Test 28
Verdict: ACCEPTED
| input |
|---|
| 10 9 1 7 5 4 3 2 8 6 9 10 5 9 1 2 1 3 3 1 1 |
| correct output |
|---|
| 2 1 1 4 1 2 2 1 1 |
| user output |
|---|
| 2 1 1 4 1 2 2 1 1 |
Test 29
Verdict: ACCEPTED
| input |
|---|
| 10 10 3 4 5 6 7 8 9 10 1 2 6 2 10 9 8 7 7 6 3 2 |
| correct output |
|---|
| 5 5 5 5 5 5 5 5 5 5 |
| user output |
|---|
| 5 5 5 5 5 5 5 5 5 5 |
Test 30
Verdict: ACCEPTED
| input |
|---|
| 10 5 1 4 6 5 9 7 3 8 2 10 1 7 4 8 4 |
| correct output |
|---|
| 1 3 4 1 4 |
| user output |
|---|
| 1 3 4 1 4 |
Test 31
Verdict: ACCEPTED
| input |
|---|
| 10 1 9 5 1 4 2 10 3 7 6 8 4 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 32
Verdict: ACCEPTED
| input |
|---|
| 10 10 1 3 2 5 4 6 7 10 8 9 4 6 3 6 1 1 5 3 1 5 |
| correct output |
|---|
| 2 1 2 1 1 1 2 2 1 2 |
| user output |
|---|
| 2 1 2 1 1 1 2 2 1 2 |
Test 33
Verdict: ACCEPTED
| input |
|---|
| 10 6 8 6 3 10 1 5 7 2 4 9 9 3 5 1 7 5 |
| correct output |
|---|
| 3 1 5 5 1 5 |
| user output |
|---|
| 3 1 5 5 1 5 |
Test 34
Verdict: ACCEPTED
| input |
|---|
| 10 1 1 4 2 3 7 5 6 8 9 10 3 |
| correct output |
|---|
| 3 |
| user output |
|---|
| 3 |
Test 35
Verdict: ACCEPTED
| input |
|---|
| 100 78 8 2 4 12 9 1 7 6 3 11 10 5 15 ... |
| correct output |
|---|
| 11 8 3 2 1 1 1 5 8 5 1 5 6 1 4... |
| user output |
|---|
| 11 8 3 2 1 1 1 5 8 5 1 5 6 1 4... |
Test 36
Verdict: ACCEPTED
| input |
|---|
| 100 6 7 17 9 15 1 5 6 19 16 8 20 12 ... |
| correct output |
|---|
| 3 7 3 5 10 7 |
| user output |
|---|
| 3 7 3 5 10 7 |
Test 37
Verdict: ACCEPTED
| input |
|---|
| 100 35 2 1 3 4 5 8 15 14 6 7 11 9 12 ... |
| correct output |
|---|
| 5 12 2 2 12 13 13 12 7 12 3 12... |
| user output |
|---|
| 5 12 2 2 12 13 13 12 7 12 3 12... |
Test 38
Verdict: ACCEPTED
| input |
|---|
| 100 98 1 2 18 5 7 15 11 19 6 3 17 10 ... |
| correct output |
|---|
| 16 7 14 11 4 11 14 14 14 16 14... |
| user output |
|---|
| 16 7 14 11 4 11 14 14 14 16 14... |
Test 39
Verdict: ACCEPTED
| input |
|---|
| 100 91 3 4 5 6 7 8 9 10 11 12 13 14 1... |
| correct output |
|---|
| 50 50 50 50 50 50 50 50 50 50 ... |
| user output |
|---|
| 50 50 50 50 50 50 50 50 50 50 ... |
Test 40
Verdict: ACCEPTED
| input |
|---|
| 100 57 6 5 3 2 4 1 14 17 36 41 32 22 ... |
| correct output |
|---|
| 1 2 12 2 1 7 5 10 3 10 10 29 1... |
| user output |
|---|
| 1 2 12 2 1 7 5 10 3 10 10 29 1... |
Test 41
Verdict: ACCEPTED
| input |
|---|
| 100 58 11 92 21 40 79 26 20 7 53 16 3... |
| correct output |
|---|
| 18 68 68 18 68 18 18 68 68 68 ... |
| user output |
|---|
| 18 68 68 18 68 18 18 68 68 68 ... |
Test 42
Verdict: ACCEPTED
| input |
|---|
| 100 47 23 5 11 3 16 21 13 10 8 18 15 ... |
| correct output |
|---|
| 15 15 10 10 10 10 1 5 10 10 7 ... |
| user output |
|---|
| 15 15 10 10 10 10 1 5 10 10 7 ... |
Test 43
Verdict: ACCEPTED
| input |
|---|
| 100 54 42 57 3 73 56 79 95 17 60 23 8... |
| correct output |
|---|
| 72 8 72 18 72 72 18 72 1 72 72... |
| user output |
|---|
| 72 8 72 18 72 72 18 72 1 72 72... |
Test 44
Verdict: ACCEPTED
| input |
|---|
| 100 8 16 14 30 28 23 1 26 25 8 22 13... |
| correct output |
|---|
| 21 3 1 1 6 21 1 4 |
| user output |
|---|
| 21 3 1 1 6 21 1 4 |
Test 45
Verdict: ACCEPTED
| input |
|---|
| 200 32 8 2 4 12 9 1 7 6 3 11 10 5 15 ... |
| correct output |
|---|
| 11 1 15 15 11 5 5 8 9 11 15 3 ... |
| user output |
|---|
| 11 1 15 15 11 5 5 8 9 11 15 3 ... |
Test 46
Verdict: ACCEPTED
| input |
|---|
| 200 30 7 17 9 15 1 5 6 19 16 8 20 12 ... |
| correct output |
|---|
| 13 1 5 2 10 4 11 4 13 11 6 4 1... |
| user output |
|---|
| 13 1 5 2 10 4 11 4 13 11 6 4 1... |
Test 47
Verdict: ACCEPTED
| input |
|---|
| 200 87 2 1 3 4 5 8 15 14 6 7 11 9 12 ... |
| correct output |
|---|
| 6 6 3 14 3 12 3 2 4 2 2 9 11 1... |
| user output |
|---|
| 6 6 3 14 3 12 3 2 4 2 2 9 11 1... |
Test 48
Verdict: ACCEPTED
| input |
|---|
| 200 75 1 2 18 5 7 15 11 19 6 3 17 10 ... |
| correct output |
|---|
| 10 8 5 7 9 9 10 7 10 7 2 1 3 1... |
| user output |
|---|
| 10 8 5 7 9 9 10 7 10 7 2 1 3 1... |
Test 49
Verdict: ACCEPTED
| input |
|---|
| 200 181 3 4 5 6 7 8 9 10 11 12 13 14 1... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 50
Verdict: ACCEPTED
| input |
|---|
| 200 63 6 5 10 2 8 1 3 4 9 12 11 7 82 ... |
| correct output |
|---|
| 19 22 19 39 1 19 7 39 6 4 27 3... |
| user output |
|---|
| 19 22 19 39 1 19 7 39 6 4 27 3... |
Test 51
Verdict: ACCEPTED
| input |
|---|
| 200 99 11 92 21 164 79 144 20 7 105 1... |
| correct output |
|---|
| 138 38 138 138 138 138 138 2 1... |
| user output |
|---|
| 138 38 138 138 138 138 138 2 1... |
Test 52
Verdict: ACCEPTED
| input |
|---|
| 200 52 31 25 18 4 38 19 46 29 8 44 21... |
| correct output |
|---|
| 57 57 13 42 24 57 15 42 57 42 ... |
| user output |
|---|
| 57 57 13 42 24 57 15 42 57 42 ... |
Test 53
Verdict: ACCEPTED
| input |
|---|
| 200 95 42 57 3 119 56 173 95 191 60 1... |
| correct output |
|---|
| 144 144 144 32 144 144 144 144... |
| user output |
|---|
| 144 144 144 32 144 144 144 144... |
Test 54
Verdict: ACCEPTED
| input |
|---|
| 200 11 16 67 30 28 23 1 38 61 64 22 1... |
| correct output |
|---|
| 63 16 63 47 47 12 47 3 6 47 1 |
| user output |
|---|
| 63 16 63 47 47 12 47 3 6 47 1 |
Test 55
Verdict: ACCEPTED
| input |
|---|
| 1000 411 8 2 4 12 9 1 7 6 3 11 10 5 15 ... |
| correct output |
|---|
| 3 11 1 8 9 1 1 6 12 1 1 7 4 14... |
| user output |
|---|
| 3 11 1 8 9 1 1 6 12 1 1 7 4 14... |
Test 56
Verdict: ACCEPTED
| input |
|---|
| 1000 186 7 17 9 15 1 5 6 19 16 8 20 12 ... |
| correct output |
|---|
| 13 3 2 10 17 4 12 3 1 7 9 8 11... |
| user output |
|---|
| 13 3 2 10 17 4 12 3 1 7 9 8 11... |
Test 57
Verdict: ACCEPTED
| input |
|---|
| 1000 952 2 1 3 4 5 8 15 14 6 7 11 9 12 ... |
| correct output |
|---|
| 5 19 7 7 5 4 1 14 11 8 3 6 12 ... |
| user output |
|---|
| 5 19 7 7 5 4 1 14 11 8 3 6 12 ... |
Test 58
Verdict: ACCEPTED
| input |
|---|
| 1000 975 1 2 18 5 7 15 11 19 6 3 17 10 ... |
| correct output |
|---|
| 1 5 3 4 5 6 9 8 1 15 10 15 4 2... |
| user output |
|---|
| 1 5 3 4 5 6 9 8 1 15 10 15 4 2... |
Test 59
Verdict: ACCEPTED
| input |
|---|
| 1000 901 3 4 5 6 7 8 9 10 11 12 13 14 1... |
| correct output |
|---|
| 500 500 500 500 500 500 500 50... |
| user output |
|---|
| 500 500 500 500 500 500 500 50... |
Test 60
Verdict: ACCEPTED
| input |
|---|
| 1000 294 6 22 37 28 14 56 55 49 29 12 4... |
| correct output |
|---|
| 30 231 231 290 290 290 244 2 1... |
| user output |
|---|
| 30 231 231 290 290 290 244 2 1... |
Test 61
Verdict: ACCEPTED
| input |
|---|
| 1000 635 446 970 21 164 995 689 783 426... |
| correct output |
|---|
| 681 681 681 681 83 83 681 198 ... |
| user output |
|---|
| 681 681 681 681 83 83 681 198 ... |
Test 62
Verdict: ACCEPTED
| input |
|---|
| 1000 59 217 160 224 49 38 19 46 194 8 ... |
| correct output |
|---|
| 27 52 333 333 23 333 333 27 33... |
| user output |
|---|
| 27 52 333 333 23 333 333 27 33... |
Test 63
Verdict: ACCEPTED
| input |
|---|
| 1000 981 451 340 330 827 925 173 494 19... |
| correct output |
|---|
| 634 634 149 634 634 634 634 63... |
| user output |
|---|
| 634 634 149 634 634 634 634 63... |
Test 64
Verdict: ACCEPTED
| input |
|---|
| 1000 250 16 272 312 28 23 258 144 194 2... |
| correct output |
|---|
| 186 70 88 70 186 246 70 88 246... |
| user output |
|---|
| 186 70 88 70 186 246 70 88 246... |
Test 65
Verdict: ACCEPTED
| input |
|---|
| 100000 15183 8 2 4 12 9 1 7 6 3 11 10 5 15 ... |
| correct output |
|---|
| 3 2 8 9 6 4 18 7 13 8 3 6 10 1... |
| user output |
|---|
| 3 2 8 9 6 4 18 7 13 8 3 6 10 1... |
Test 66
Verdict: ACCEPTED
| input |
|---|
| 100000 80738 7 17 9 15 1 5 6 19 16 8 20 12 ... |
| correct output |
|---|
| 9 2 2 2 8 8 7 4 12 9 5 4 14 6 ... |
| user output |
|---|
| 9 2 2 2 8 8 7 4 12 9 5 4 14 6 ... |
Test 67
Verdict: ACCEPTED
| input |
|---|
| 100000 88540 2 1 3 4 5 8 15 14 6 7 11 9 12 ... |
| correct output |
|---|
| 4 13 2 2 3 1 15 11 4 2 12 13 1... |
| user output |
|---|
| 4 13 2 2 3 1 15 11 4 2 12 13 1... |
Test 68
Verdict: ACCEPTED
| input |
|---|
| 100000 95145 1 2 18 5 7 15 11 19 6 3 17 10 ... |
| correct output |
|---|
| 12 8 5 2 1 9 13 17 5 14 1 11 5... |
| user output |
|---|
| 12 8 5 2 1 9 13 17 5 14 1 11 5... |
Test 69
Verdict: ACCEPTED
| input |
|---|
| 100000 90064 3 4 5 6 7 8 9 10 11 12 13 14 1... |
| correct output |
|---|
| 50000 50000 50000 50000 50000 ... |
| user output |
|---|
| 50000 50000 50000 50000 50000 ... |
Test 70
Verdict: ACCEPTED
| input |
|---|
| 100000 98544 1197 327 641 3158 2038 1048 56... |
| correct output |
|---|
| 51677 37867 37867 216 51677 51... |
| user output |
|---|
| 51677 37867 37867 216 51677 51... |
Test 71
Verdict: ACCEPTED
| input |
|---|
| 100000 57490 70439 82301 64482 96766 51484 ... |
| correct output |
|---|
| 11976 62820 62820 62820 2808 6... |
| user output |
|---|
| 11976 62820 62820 62820 2808 6... |
Test 72
Verdict: ACCEPTED
| input |
|---|
| 100000 72506 16265 2606 21836 8643 4486 321... |
| correct output |
|---|
| 44533 16055 11222 11222 16055 ... |
| user output |
|---|
| 44533 16055 11222 11222 16055 ... |
Test 73
Verdict: ACCEPTED
| input |
|---|
| 100000 64645 47136 80135 73346 78143 9204 6... |
| correct output |
|---|
| 13351 40626 40626 40626 40414 ... |
| user output |
|---|
| 13351 40626 40626 40626 40414 ... |
Test 74
Verdict: ACCEPTED
| input |
|---|
| 100000 6200 17945 16321 396 7538 19397 151... |
| correct output |
|---|
| 115 13754 19010 13754 9095 137... |
| user output |
|---|
| 115 13754 19010 13754 9095 137... |
