답안 #543059

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
543059 2022-03-29T03:02:07 Z amunduzbaev Fireworks (APIO16_fireworks) C++17
7 / 100
4 ms 7372 KB
#include "bits/stdc++.h"
using namespace std;

#define ar array

const int N = 3e5 + 5;
vector<ar<int, 2>> edges[N];

signed main(){
	ios::sync_with_stdio(0); cin.tie(0); 

	int n, m; cin>>n>>m;
	for(int i=1;i<n+m;i++){
		int p, c; cin>>p>>c;
		edges[--p].push_back({i, c});
	}
	
	if(n == 1){
		sort(edges[0].begin(), edges[0].end(), [&](auto& a, auto& b){
			return a[1] < b[1];
		});
		
		int C = edges[0][m / 2][1];
		long long res = 0;
		for(auto x : edges[0]) res += abs(C - x[1]);
		cout<<res<<"\n";
		return 0;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7368 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 4 ms 7252 KB Output is correct
4 Correct 4 ms 7372 KB Output is correct
5 Correct 4 ms 7368 KB Output is correct
6 Correct 4 ms 7252 KB Output is correct
7 Correct 4 ms 7368 KB Output is correct
8 Correct 4 ms 7372 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 7252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7368 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 4 ms 7252 KB Output is correct
4 Correct 4 ms 7372 KB Output is correct
5 Correct 4 ms 7368 KB Output is correct
6 Correct 4 ms 7252 KB Output is correct
7 Correct 4 ms 7368 KB Output is correct
8 Correct 4 ms 7372 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Incorrect 4 ms 7252 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7368 KB Output is correct
2 Correct 4 ms 7252 KB Output is correct
3 Correct 4 ms 7252 KB Output is correct
4 Correct 4 ms 7372 KB Output is correct
5 Correct 4 ms 7368 KB Output is correct
6 Correct 4 ms 7252 KB Output is correct
7 Correct 4 ms 7368 KB Output is correct
8 Correct 4 ms 7372 KB Output is correct
9 Correct 4 ms 7252 KB Output is correct
10 Correct 4 ms 7252 KB Output is correct
11 Incorrect 4 ms 7252 KB Output isn't correct
12 Halted 0 ms 0 KB -