# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425351 | APROHACK | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "boxes.h"
#define PB push_back
#define F first
#define S second
using namespace std;
pair<long long, long long>teams[10000002];
int kt, lt, n;
int dp(int poscur, int ksobrante){
return 0;
}
long long delivery(int N, int K, int L, int p[]) {
int ant = p[0], rep = 1, pointer = 0;
kt=K, n = N, lt = L;
for(int i = 1 ; i < N ; i++){
if(p[i]!=ant){
teams[pointer++]={ant, rep};
rep=1;
}else rep++;
ant=p[i];
}
int mx=L/2, temp=INT_MAX;
long long sm = 0;
for(int i = 0 ; i < pointer ; i++){
if(teams[i].F>mx){
temp=i;
break;
}
sm+=teams[i].S*2*teams[i].F;
}
for(int i = pointer-1 ; i >= temp ; i--){
sm+=teams[i].S*2*(L-teams[i].F);
}
return sm;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |