답안 #438968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
438968 2021-06-29T02:10:54 Z adamjinwei 전선 연결 (IOI17_wiring) C++14
0 / 100
1 ms 316 KB
#include <bits/stdc++.h>
#include "wiring.h"
#define inf 1000000007
#define mod 1000000007
#define rnd() rand_num()
#define bigrnd() dis(rand_num)
//#pragma GCC optimize("Ofast","inline","-ffast-math")
//#pragma GCC target("avx,sse2,sse3,sse4,mmx")
//#define int long long
using namespace std;
unsigned sed=std::chrono::system_clock::now().time_since_epoch().count();
mt19937 rand_num(sed);
uniform_int_distribution<long long> dis(0,inf);
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n,m;
int r[100005],b[100005];
long long min_total_length(vector<int> R,vector<int> B)
{
	n=R.size();
	m=B.size();
	for(int i=1;i<=n;++i)
		r[i]=R[i-1];
	for(int i=1;i<=m;++i)
		b[i]=B[i-1];
	long long ans=0;
	int id1=1,id2=1;
	while(id1<=n&&id2<=m)
	{
		ans+=abs(r[id1]-b[id2]);
		id1++;
		id2++;
	}
	while(id1<=n)
	{
		ans+=abs(r[id1]-b[m]);
		id1++;
	}
	while(id2<=m)
	{
		ans+=abs(r[n]-b[id2]);
		id2++;
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 316 KB 3rd lines differ - on the 1st token, expected: '14340', found: '17422'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '904', found: '1109'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '17703', found: '19052'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '27', found: '30'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 316 KB 3rd lines differ - on the 1st token, expected: '14340', found: '17422'
3 Halted 0 ms 0 KB -