| Task: | Box Stack II |
| Sender: | aalto26dw_001 |
| Submission time: | 2026-09-23 17:18:05 +0300 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.00 s | details |
| #7 | WRONG ANSWER | 0.00 s | details |
| #8 | WRONG ANSWER | 0.00 s | details |
| #9 | WRONG ANSWER | 0.00 s | details |
| #10 | WRONG ANSWER | 0.00 s | details |
| #11 | WRONG ANSWER | 0.00 s | details |
| #12 | WRONG ANSWER | 0.00 s | details |
| #13 | WRONG ANSWER | 0.00 s | details |
| #14 | WRONG ANSWER | 0.00 s | details |
| #15 | WRONG ANSWER | 0.00 s | details |
| #16 | WRONG ANSWER | 0.00 s | details |
| #17 | WRONG ANSWER | 0.00 s | details |
| #18 | WRONG ANSWER | 0.00 s | details |
| #19 | WRONG ANSWER | 0.00 s | details |
| #20 | WRONG ANSWER | 0.00 s | details |
| #21 | WRONG ANSWER | 0.00 s | details |
| #22 | WRONG ANSWER | 0.00 s | details |
| #23 | WRONG ANSWER | 0.00 s | details |
| #24 | WRONG ANSWER | 0.00 s | details |
| #25 | ACCEPTED | 0.00 s | details |
| #26 | WRONG ANSWER | 0.00 s | details |
| #27 | WRONG ANSWER | 0.00 s | details |
| #28 | WRONG ANSWER | 0.00 s | details |
| #29 | WRONG ANSWER | 0.00 s | details |
| #30 | WRONG ANSWER | 0.00 s | details |
| #31 | WRONG ANSWER | 0.00 s | details |
| #32 | WRONG ANSWER | 0.00 s | details |
| #33 | WRONG ANSWER | 0.00 s | details |
| #34 | WRONG ANSWER | 0.00 s | details |
| #35 | WRONG ANSWER | 0.00 s | details |
| #36 | WRONG ANSWER | 0.00 s | details |
| #37 | WRONG ANSWER | 0.00 s | details |
| #38 | WRONG ANSWER | 0.00 s | details |
| #39 | WRONG ANSWER | 0.00 s | details |
| #40 | WRONG ANSWER | 0.00 s | details |
| #41 | WRONG ANSWER | 0.00 s | details |
| #42 | WRONG ANSWER | 0.01 s | details |
| #43 | WRONG ANSWER | 0.01 s | details |
| #44 | WRONG ANSWER | 0.01 s | details |
| #45 | WRONG ANSWER | 0.01 s | details |
| #46 | WRONG ANSWER | 0.01 s | details |
| #47 | WRONG ANSWER | 0.01 s | details |
| #48 | WRONG ANSWER | 0.01 s | details |
| #49 | WRONG ANSWER | 0.01 s | details |
| #50 | WRONG ANSWER | 0.01 s | details |
| #51 | WRONG ANSWER | 0.01 s | details |
| #52 | WRONG ANSWER | 0.03 s | details |
| #53 | WRONG ANSWER | 0.03 s | details |
| #54 | WRONG ANSWER | 0.03 s | details |
| #55 | WRONG ANSWER | 0.03 s | details |
| #56 | WRONG ANSWER | 0.03 s | details |
| #57 | WRONG ANSWER | 0.03 s | details |
| #58 | WRONG ANSWER | 0.03 s | details |
| #59 | WRONG ANSWER | 0.03 s | details |
| #60 | WRONG ANSWER | 0.03 s | details |
| #61 | WRONG ANSWER | 0.03 s | details |
| #62 | TIME LIMIT EXCEEDED | -- | details |
| #63 | TIME LIMIT EXCEEDED | -- | details |
| #64 | TIME LIMIT EXCEEDED | -- | details |
| #65 | TIME LIMIT EXCEEDED | -- | details |
| #66 | TIME LIMIT EXCEEDED | -- | details |
| #67 | TIME LIMIT EXCEEDED | -- | details |
| #68 | TIME LIMIT EXCEEDED | -- | details |
| #69 | TIME LIMIT EXCEEDED | -- | details |
| #70 | TIME LIMIT EXCEEDED | -- | details |
| #71 | TIME LIMIT EXCEEDED | -- | details |
| #72 | WRONG ANSWER | 0.34 s | details |
| #73 | TIME LIMIT EXCEEDED | -- | details |
Compiler report
input/code.cpp: In function 'void boxStacking()':
input/code.cpp:513:21: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
513 | m = {(1<<31)-1,(1<<31)-1};
| ~~~~~~~^~
input/code.cpp:513:31: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
513 | m = {(1<<31)-1,(1<<31)-1};
| ~~~~~~~^~Code
#include <iostream>
#include <vector>
#include <functional>
#include <set>
#include <algorithm>
#include <stack>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <limits>
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++){
if ((i%width) == width-1 && i != (int)arr.size()-1){
print(" ");
println(arr[i]);
}else if ((i%width) == 0){
print(arr[i]);
}else {
print(" ");
print(arr[i]);
}
}
}
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(T init, const std::function<std::vector<T>(T)> operate){
std::stack<T> stack;
stack.push(init);
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 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(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 T>
std::tuple<T, std::vector<int>> shortestPath(const std::vector<std::tuple<int, int, T>> &edgesMessy, int start, int goal){
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, goal);
}
template<typename T>
std::tuple<T, std::vector<int>> shortestPathDirected(const std::vector<std::tuple<int, int, T>> &edgesMessy, int start, int goal){
//assumes all are between 0 <= n < c*(number of vertexies), where c is reasonably small constant.
std::vector<int> vertexies = {};
for (auto& [s,g,c] : edgesMessy){
vertexies.push_back(s);
vertexies.push_back(g);
}
std::vector<std::tuple<int, int, T>> edges = edgesMessy;
int mappedStart = start;
int mappedEnd = goal;
int n = max(vertexies)+1;
std::vector<T> distance(n);
std::vector<int> path(n);
for (int i = 0; i < n; i++) distance[i] = std::numeric_limits<T>::max()/4;
for (int i = 0; i < n; i++) path[i] = i;
distance[mappedStart] = 0;
for (int i = 1; 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){
// handle inifnite loop This could be made to find the infinite loop instead.
return std::tuple((T)0,(std::vector<int>){});
}
}
std::vector<int> fullPath = {goal};
while (fullPath[fullPath.size()-1] != start){
fullPath.push_back(path[fullPath[fullPath.size()-1]]);
}
return std::tuple(distance[mappedEnd],reverse(fullPath));
}
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::vector<int> dynamicUpdater(std::vector<std::tuple<int,int>> get, std::function<int(std::unordered_map<std::tuple<int,int>, int>&,std::tuple<int,int>)> eval, std::function<std::vector<std::tuple<int,int>>(std::tuple<int,int>)> needs){
std::map<std::tuple<int,int>, int> results;
std::stack<std::tuple<int,int>> toDo;
for (auto val : get){
toDo.push(val);
}
std::function<bool(std::tuple<int,int>)> has = [&results](std::tuple<int,int> &value){
return results.find(value) != results.end();
};
while (toDo.size() != 0){
auto next = toDo.top();
toDo.pop();
if (results.find(next) != results.end()){
} else if (forall(needs(next))){
results[next] = eval(results,next);
} else {
for (auto val : needs(next)){
toDo.push(val);
}
}
}
std::function<int(std::tuple<int,int>)> resultMap = [&results](std::tuple<int,int> &value){
return results[value];
};
return map(get,resultMap);
}*/
/*
template<typename T, typename R>
std::vector<R> dynamicUpdater(std::vector<T> get, std::function<R(std::unordered_map<T, R>&,T)> eval, std::function<std::vector<T>(T)> needs){
std::map<T, R> results;
std::stack<T> toDo;
for (auto val : get){
toDo.push(val);
}
std::function<bool(T)> has = [&results](T &value){
return results.find(value) != results.end();
};
while (toDo.size() != 0){
auto next = toDo.top();
toDo.pop();
if (results.find(next) != results.end()){
} else if (forall(needs(next))){
results[next] = eval(results,next);
} else {
for (auto val : needs(next)){
toDo.push(val);
}
}
}
std::function<R(T)> resultMap = [&results](T &value){
return results[value];
};
return map(get,resultMap);
}
*/
void boxStacking(){
auto [nInit] = readInt1();
auto arrInit = readVecTup3(nInit);
sorted(arrInit);
std::vector<std::tuple<int, int, int>> arr = {arrInit[0]};
for (int i = 1; i < nInit; i++){
auto &[a,b,c] = arr[arr.size()-1];
auto [x,y,z] = arrInit[i];
if (a==x && b==y){
c += z;
} else {
arr.push_back({x,y,z});
}
}
int n = arr.size();
std::vector<std::tuple<int, int, long long>> edges;
std::vector<std::tuple<int, int>> listMin(n);
for (auto &m : listMin){
m = {(1<<31)-1,(1<<31)-1};
}
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
if (i == j) continue;
auto [a,b,c] = arr[i];
auto [x,y,z] = arr[j];
auto [mx,my] = listMin[j];
if (a > mx && b > my) continue;
if (a >= x && b >= y){
edges.push_back({i,j,-z});
if (a < mx && b < my) listMin[j] = {a,b}; //a + b < mx + my
}
}
}
println(edges.size());
int start = n;
int end = n+1;
for (int i = 0; i < n; i++){
auto [x,y,z] = arr[i];
edges.push_back({start,i,-z});
edges.push_back({i,end,0});
}
auto [cost, path] = shortestPathDirected(edges,start,end);
println(-cost);
}
int main() {
//std::vector<std::vector<int>> a;
//for (int i = 0; i < 5; i++){
// std::vector<int> b = {1,2,3};
// a.push_back(b);
//}
//println(a,1);
//marioKart2();
//particles();
boxStacking();
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 1 7 8 3 |
| correct output |
|---|
| 3 |
| user output |
|---|
| 0 3 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 2 6 5 4 1 1 1 |
| correct output |
|---|
| 5 |
| user output |
|---|
| 1 5 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 2 3 6 7 9 7 10 |
| correct output |
|---|
| 17 |
| user output |
|---|
| 1 17 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 2 5 1 3 8 5 9 |
| correct output |
|---|
| 12 |
| user output |
|---|
| 1 12 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 3 7 7 4 2 6 9 2 5 2 |
| correct output |
|---|
| 15 |
| user output |
|---|
| 2 15 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 3 8 2 9 9 6 8 7 7 3 |
| correct output |
|---|
| 17 |
| user output |
|---|
| 1 17 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 3 1 6 6 5 1 9 10 6 10 |
| correct output |
|---|
| 19 |
| user output |
|---|
| 2 19 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 4 1 2 1 7 8 3 3 4 8 6 6 3 |
| correct output |
|---|
| 15 |
| user output |
|---|
| 3 15 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 4 8 2 9 9 6 8 7 7 3 1 6 4 |
| correct output |
|---|
| 17 |
| user output |
|---|
| 3 17 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 4 1 2 3 5 2 10 6 2 5 7 3 6 |
| correct output |
|---|
| 24 |
| user output |
|---|
| 4 24 |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 4 9 7 7 3 8 3 2 2 10 10 7 4 |
| correct output |
|---|
| 21 |
| user output |
|---|
| 4 21 |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 5 6 6 8 9 7 9 6 9 5 7 7 4 ... |
| correct output |
|---|
| 30 |
| user output |
|---|
| 6 30 |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 5 5 10 8 10 1 2 4 10 2 3 1 4 ... |
| correct output |
|---|
| 14 |
| user output |
|---|
| 6 14 |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 5 5 2 1 10 6 10 5 5 5 4 4 2 ... |
| correct output |
|---|
| 17 |
| user output |
|---|
| 3 17 |
Test 15
Verdict: WRONG ANSWER
| input |
|---|
| 5 6 1 8 9 3 2 6 6 9 5 9 1 ... |
| correct output |
|---|
| 20 |
| user output |
|---|
| 6 20 |
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 5 10 10 6 2 10 9 8 7 7 6 3 2 ... |
| correct output |
|---|
| 15 |
| user output |
|---|
| 5 15 |
Test 17
Verdict: WRONG ANSWER
| input |
|---|
| 5 3 1 9 9 3 4 10 10 5 1 7 4 ... |
| correct output |
|---|
| 20 |
| user output |
|---|
| 5 20 |
Test 18
Verdict: WRONG ANSWER
| input |
|---|
| 5 9 10 4 3 9 1 1 4 2 10 6 1 ... |
| correct output |
|---|
| 11 |
| user output |
|---|
| 5 11 |
Test 19
Verdict: WRONG ANSWER
| input |
|---|
| 5 1 3 8 4 5 10 8 5 10 4 6 3 ... |
| correct output |
|---|
| 28 |
| user output |
|---|
| 6 28 |
Test 20
Verdict: WRONG ANSWER
| input |
|---|
| 5 9 1 10 3 9 4 6 9 3 5 1 7 ... |
| correct output |
|---|
| 17 |
| user output |
|---|
| 4 17 |
Test 21
Verdict: WRONG ANSWER
| input |
|---|
| 5 1 4 6 5 5 1 2 4 2 1 3 9 ... |
| correct output |
|---|
| 18 |
| user output |
|---|
| 5 18 |
Test 22
Verdict: WRONG ANSWER
| input |
|---|
| 10 6 6 8 9 7 9 6 9 5 7 7 4 ... |
| correct output |
|---|
| 41 |
| user output |
|---|
| 17 41 |
Test 23
Verdict: WRONG ANSWER
| input |
|---|
| 10 5 10 8 10 1 2 4 10 2 3 1 4 ... |
| correct output |
|---|
| 35 |
| user output |
|---|
| 11 35 |
Test 24
Verdict: WRONG ANSWER
| input |
|---|
| 10 5 2 1 10 6 10 5 5 5 4 4 2 ... |
| correct output |
|---|
| 33 |
| user output |
|---|
| 15 33 |
Test 25
Verdict: ACCEPTED
| input |
|---|
| 10 6 1 8 9 3 2 6 6 9 5 9 1 ... |
| correct output |
|---|
| 21 |
| user output |
|---|
| 21 21 |
Test 26
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 6 2 10 9 8 7 7 6 3 2 ... |
| correct output |
|---|
| 36 |
| user output |
|---|
| 21 36 |
Test 27
Verdict: WRONG ANSWER
| input |
|---|
| 10 3 1 9 9 3 4 10 10 5 1 7 4 ... |
| correct output |
|---|
| 37 |
| user output |
|---|
| 13 37 |
Test 28
Verdict: WRONG ANSWER
| input |
|---|
| 10 9 10 4 3 9 1 1 4 2 10 6 1 ... |
| correct output |
|---|
| 25 |
| user output |
|---|
| 17 25 |
Test 29
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 3 8 4 5 10 8 5 10 4 6 3 ... |
| correct output |
|---|
| 33 |
| user output |
|---|
| 19 33 |
Test 30
Verdict: WRONG ANSWER
| input |
|---|
| 10 9 1 10 3 9 4 6 9 3 5 1 7 ... |
| correct output |
|---|
| 28 |
| user output |
|---|
| 19 28 |
Test 31
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 4 6 5 5 1 2 4 2 1 3 9 ... |
| correct output |
|---|
| 29 |
| user output |
|---|
| 16 29 |
Test 32
Verdict: WRONG ANSWER
| input |
|---|
| 100 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
| correct output |
|---|
| 10998205207 |
| user output |
|---|
| 1408 10998205207 |
Test 33
Verdict: WRONG ANSWER
| input |
|---|
| 100 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
| correct output |
|---|
| 8897447989 |
| user output |
|---|
| 1122 8897447989 |
Test 34
Verdict: WRONG ANSWER
| input |
|---|
| 100 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
| correct output |
|---|
| 9141888792 |
| user output |
|---|
| 1151 9141888792 |
Test 35
Verdict: WRONG ANSWER
| input |
|---|
| 100 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
| correct output |
|---|
| 10698400685 |
| user output |
|---|
| 1563 10698400685 |
Test 36
Verdict: WRONG ANSWER
| input |
|---|
| 100 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
| correct output |
|---|
| 12833486742 |
| user output |
|---|
| 1165 12833486742 |
Test 37
Verdict: WRONG ANSWER
| input |
|---|
| 100 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
| correct output |
|---|
| 11001071375 |
| user output |
|---|
| 1185 11001071375 |
Test 38
Verdict: WRONG ANSWER
| input |
|---|
| 100 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
| correct output |
|---|
| 8425454448 |
| user output |
|---|
| 1303 8425454448 |
Test 39
Verdict: WRONG ANSWER
| input |
|---|
| 100 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
| correct output |
|---|
| 10342518662 |
| user output |
|---|
| 1189 10342518662 |
Test 40
Verdict: WRONG ANSWER
| input |
|---|
| 100 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
| correct output |
|---|
| 8144852495 |
| user output |
|---|
| 1219 8144852495 |
Test 41
Verdict: WRONG ANSWER
| input |
|---|
| 100 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
| correct output |
|---|
| 9522402349 |
| user output |
|---|
| 1220 9522402349 |
Test 42
Verdict: WRONG ANSWER
| input |
|---|
| 200 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
| correct output |
|---|
| 15209742885 |
| user output |
|---|
| 5211 15209742885 |
Test 43
Verdict: WRONG ANSWER
| input |
|---|
| 200 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
| correct output |
|---|
| 13615506574 |
| user output |
|---|
| 4773 13615506574 |
Test 44
Verdict: WRONG ANSWER
| input |
|---|
| 200 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
| correct output |
|---|
| 12798974974 |
| user output |
|---|
| 4906 12798974974 |
Test 45
Verdict: WRONG ANSWER
| input |
|---|
| 200 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
| correct output |
|---|
| 15137965961 |
| user output |
|---|
| 4947 15137965961 |
Test 46
Verdict: WRONG ANSWER
| input |
|---|
| 200 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
| correct output |
|---|
| 17343709538 |
| user output |
|---|
| 4682 17343709538 |
Test 47
Verdict: WRONG ANSWER
| input |
|---|
| 200 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
| correct output |
|---|
| 16484729704 |
| user output |
|---|
| 5101 16484729704 |
Test 48
Verdict: WRONG ANSWER
| input |
|---|
| 200 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
| correct output |
|---|
| 13668103642 |
| user output |
|---|
| 4900 13668103642 |
Test 49
Verdict: WRONG ANSWER
| input |
|---|
| 200 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
| correct output |
|---|
| 12761842389 |
| user output |
|---|
| 5053 12761842389 |
Test 50
Verdict: WRONG ANSWER
| input |
|---|
| 200 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
| correct output |
|---|
| 13061107314 |
| user output |
|---|
| 5052 13061107314 |
Test 51
Verdict: WRONG ANSWER
| input |
|---|
| 200 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
| correct output |
|---|
| 14114713109 |
| user output |
|---|
| 4775 14114713109 |
Test 52
Verdict: WRONG ANSWER
| input |
|---|
| 1000 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
| correct output |
|---|
| 33891762384 |
| user output |
|---|
| 129981 33891762384 |
Test 53
Verdict: WRONG ANSWER
| input |
|---|
| 1000 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
| correct output |
|---|
| 33355847789 |
| user output |
|---|
| 120082 33355847789 |
Test 54
Verdict: WRONG ANSWER
| input |
|---|
| 1000 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
| correct output |
|---|
| 33709682513 |
| user output |
|---|
| 121722 33709682513 |
Test 55
Verdict: WRONG ANSWER
| input |
|---|
| 1000 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
| correct output |
|---|
| 34006550890 |
| user output |
|---|
| 130112 34006550890 |
Test 56
Verdict: WRONG ANSWER
| input |
|---|
| 1000 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
| correct output |
|---|
| 34976444698 |
| user output |
|---|
| 128806 34976444698 |
Test 57
Verdict: WRONG ANSWER
| input |
|---|
| 1000 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
| correct output |
|---|
| 34699884028 |
| user output |
|---|
| 124544 34699884028 |
Test 58
Verdict: WRONG ANSWER
| input |
|---|
| 1000 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
| correct output |
|---|
| 34046313943 |
| user output |
|---|
| 121720 34046313943 |
Test 59
Verdict: WRONG ANSWER
| input |
|---|
| 1000 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
| correct output |
|---|
| 33580356050 |
| user output |
|---|
| 122004 33580356050 |
Test 60
Verdict: WRONG ANSWER
| input |
|---|
| 1000 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
| correct output |
|---|
| 35744107623 |
| user output |
|---|
| 120371 35744107623 |
Test 61
Verdict: WRONG ANSWER
| input |
|---|
| 1000 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
| correct output |
|---|
| 35345712189 |
| user output |
|---|
| 126545 35345712189 |
Test 62
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
| correct output |
|---|
| 526570534463 |
| user output |
|---|
| (empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
| correct output |
|---|
| 527468957174 |
| user output |
|---|
| (empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
| correct output |
|---|
| 530364449483 |
| user output |
|---|
| (empty) |
Test 65
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
| correct output |
|---|
| 531529346089 |
| user output |
|---|
| (empty) |
Test 66
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
| correct output |
|---|
| 532748830637 |
| user output |
|---|
| (empty) |
Test 67
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
| correct output |
|---|
| 525080370284 |
| user output |
|---|
| (empty) |
Test 68
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
| correct output |
|---|
| 529566966249 |
| user output |
|---|
| (empty) |
Test 69
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
| correct output |
|---|
| 521546866708 |
| user output |
|---|
| (empty) |
Test 70
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
| correct output |
|---|
| 531573800077 |
| user output |
|---|
| (empty) |
Test 71
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
| correct output |
|---|
| 529286403784 |
| user output |
|---|
| (empty) |
Test 72
Verdict: WRONG ANSWER
| input |
|---|
| 200000 1000000000 1000000000 10000000... |
| correct output |
|---|
| 200000000000000 |
| user output |
|---|
| 0 552894464 |
Test 73
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1000000000 1 1 1000000000 2 2 1000000000 3 3 1000000000 4 4 ... |
| correct output |
|---|
| 20000100000 |
| user output |
|---|
| (empty) |
