답안 #203918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
203918 2020-02-23T03:19:11 Z Segtree Fireworks (APIO16_fireworks) C++14
7 / 100
5 ms 376 KB
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod

int main(){
	ll n,m;
	cin>>n>>m;
	if(n==1){
		vector<ll> v;
		rep(i,m){
			ll p,c; cin>>p>>c;
			v.push_back(c);
		}
		sort(v.begin(),v.end());
		ll mid=v[m/2];
		ll ans=0;
		rep(i,m)ans+=abs(v[i]-mid);
		cout<<ans<<endl;
	}
}

# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 248 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 248 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Incorrect 5 ms 256 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 248 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 128 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Incorrect 5 ms 256 KB Output isn't correct
12 Halted 0 ms 0 KB -