Submission #990381

# Submission time Handle Problem Language Result Execution time Memory
990381 2024-05-30T10:50:43 Z StefanSebez Wiring (IOI17_wiring) C++14
13 / 100
18 ms 3928 KB
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ll long long
#define pb push_back
long long min_total_length(std::vector<int> r, std::vector<int> b) {
	int n=r.size(),m=b.size();
	ll res=0;
	for(int i=n-1,j=m-1;i>=0 || j>=0;){
		//cout<<i<<" "<<j<<" "<<res<<"\n";
		if(i==-1 && j>0){
			while(j>=0){
				res+=b[j]-r[n-1];
				j--;
			}
			break;
		}
		else if(i>0 && j==-1){
			while(i>=0){
				res+=b[0]-r[i];
				i--;
			}
			break;
		}
		else{
			res+=b[j]-r[i];
			j--;
			i--;
		}
	}
	/*ll dp[n+1][m+1];
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(r[i-1]>b[j-1]){
				dp[]
			}
			else{

			}
		}
	}*/
	return res;
}
# 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 12 ms 1372 KB Output is correct
4 Correct 11 ms 1544 KB Output is correct
5 Correct 11 ms 1368 KB Output is correct
6 Correct 16 ms 3776 KB Output is correct
7 Correct 18 ms 3900 KB Output is correct
8 Correct 16 ms 3928 KB Output is correct
9 Correct 17 ms 3924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 344 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 -