# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
74064 |
2018-08-29T19:36:12 Z |
renatsj |
Wiring (IOI17_wiring) |
C++14 |
|
3 ms |
652 KB |
#include<bits/stdc++.h>
#include "wiring.h"
using namespace std;
long long i,j,k,a,n,m,cur,sk,l,ab[200005],rez;
vector<long long> xx,mas;
long long min_total_length(vector<int> r,vector<int> b)
{
n=r.size();
m=b.size();
i=0;
j=0;
sk=0;
cur=-1;
while (i<n&&j<m)
{
if (r[i]<b[j])
{
if (cur==0)
{
sk++;
}
else
{
if (sk>0)
{
xx.push_back(sk);
}
sk=1;
cur=0;
}
mas.push_back(r[i]);
i++;
}
else
{
if (cur==1)
{
sk++;
}
else
{
if (sk>0)
{
xx.push_back(sk);
}
sk=1;
cur=1;
}
mas.push_back(b[j]);
j++;
}
}
ab[0]=mas[0];
i=1;
while (i<n+m)
{
ab[i]=ab[i-1]+mas[i];
i++;
}
j=0;
a=0;
k=1;
l=xx[0];
i=xx[0];
while (i<n+m)
{
if (l>0)
{
rez+=mas[i];
rez-=mas[j];
j++;
l--;
}
a++;
if (a>=xx[k])
{
if (l>0)
{
while (l>0)
{
rez+=mas[i-a+1]-mas[j];
j++;
l--;
}
l=0;
}
else
{
j=i;
}
k++;
}
i++;
}
cout << rez;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
secret mismatch |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
560 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
652 KB |
secret mismatch |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
secret mismatch |
2 |
Halted |
0 ms |
0 KB |
- |