답안 #24979

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
24979 2017-06-19T14:26:19 Z gabrielsimoes Fireworks (APIO16_fireworks) C++14
7 / 100
0 ms 2020 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
	int n, m;
	scanf("%d %d", &n, &m);

	vector<int> v; v.resize(m+n);
	vector<int> p; p.resize(m+n);
	for (int i = 1; i < n+m; i++)
		scanf("%d %d", &p[i], &v[i]);

	if (n == 1) {
		sort(v.begin()+1, v.end());
		ll ret = 0;
		for (int i = 1; i <= m; i++) ret += abs(v[(m+1)/2] - v[i]);
		return printf("%lld\n", ret), 0;
	}
}

Compilation message

fireworks.cpp: In function 'int main()':
fireworks.cpp:8:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
fireworks.cpp:13:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &p[i], &v[i]);
                               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 0 ms 2020 KB Output is correct
7 Correct 0 ms 2020 KB Output is correct
8 Correct 0 ms 2020 KB Output is correct
9 Correct 0 ms 2020 KB Output is correct
10 Correct 0 ms 2020 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 0 ms 2020 KB Output is correct
7 Correct 0 ms 2020 KB Output is correct
8 Correct 0 ms 2020 KB Output is correct
9 Correct 0 ms 2020 KB Output is correct
10 Correct 0 ms 2020 KB Output is correct
11 Incorrect 0 ms 2020 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2020 KB Output is correct
2 Correct 0 ms 2020 KB Output is correct
3 Correct 0 ms 2020 KB Output is correct
4 Correct 0 ms 2020 KB Output is correct
5 Correct 0 ms 2020 KB Output is correct
6 Correct 0 ms 2020 KB Output is correct
7 Correct 0 ms 2020 KB Output is correct
8 Correct 0 ms 2020 KB Output is correct
9 Correct 0 ms 2020 KB Output is correct
10 Correct 0 ms 2020 KB Output is correct
11 Incorrect 0 ms 2020 KB Output isn't correct
12 Halted 0 ms 0 KB -