Submission #1000094

# Submission time Handle Problem Language Result Execution time Memory
1000094 2024-06-16T16:05:19 Z Lcc735 Wiring (IOI17_wiring) C++17
13 / 100
18 ms 3932 KB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;

long long min_total_length(vector<int> r, vector<int> b) {
    sort(r.begin(),r.end());
    sort(b.begin(),b.end());
    long long l=0;
    int n=size(r); 
    int m=size(b);
    int j,i;
    if(m>n){
        j=0; 
        while(j<(m-n+1)){
            l+=-r[n-1]+b[j];
            j+=1;
        }
        i=0;
        while(j<m){
            l+=-r[i]+b[j];
            i+=1;
            j+=1;
        }
        
    }
    else{
        j=0; 
        while(j<(n-m+1)){
            l+=b[0]-r[n-j-1];
            j+=1;
        }
        i=1;
        while((n-j-1)>-1){
            l+=-r[n-j-1]+b[i];
            i+=1;
            j+=1;
        }
    }
	return l;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 14 ms 2908 KB Output is correct
4 Correct 14 ms 2944 KB Output is correct
5 Correct 13 ms 3068 KB Output is correct
6 Correct 18 ms 3928 KB Output is correct
7 Correct 18 ms 3932 KB Output is correct
8 Correct 18 ms 3768 KB Output is correct
9 Correct 18 ms 3932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '17703', found: '-19052'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '27', found: '12'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -