Submission #793383

# Submission time Handle Problem Language Result Execution time Memory
793383 2023-07-25T18:52:44 Z kingfran1907 Fireworks (APIO16_fireworks) C++14
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long llint;

const int maxn = 2e5+10;

int n, m;
int parr[maxn], len[maxn];

int main() {
	scanf("%d%d", &n, &m); 
	for (int i = 0; i < m; i++)
		scanf("%d", len+i);
	sort(len, len+m);
	int ac = (m / 2);
	
	llint sol = 0;
	for (int i = 0; i < m; i++) sol += abs(len[ac] - len[i]);
	printf("%lld\n", sol);
	return 0;
}

Compilation message

fireworks.cpp: In function 'int main()':
fireworks.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
fireworks.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", len+i);
      |   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -