Submission #3654752


Source Code Expand

Copy
#include <bits/stdc++.h>

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

int A[100];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, sum = 0, ans = 0;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i], sum += A[i], A[i] *= N;
	for (int i = 0; i < N; i++) {
		if (abs(sum - A[ans]) > abs(sum - A[i])) ans = i;
	}
	cout << ans << '\n';
	return 0;
}

Submission Info

Submission Time
Task A - Thumbnail
User Lawali
Language C++14 (GCC 5.4.1)
Score 200
Code Size 590 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
All 200 / 200 00_challenge_01, 00_sample_01, 00_sample_02, challenge_01, challenge_02, challenge_03, challenge_04, rand_01, rand_02, rand_03, rand_04, rand_pm1_01, rand_pm1_02, rand_pm1_03, rand_pm1_04
Case Name Status Exec Time Memory
00_challenge_01 1 ms 256 KB
00_sample_01 1 ms 256 KB
00_sample_02 1 ms 256 KB
challenge_01 1 ms 256 KB
challenge_02 1 ms 256 KB
challenge_03 1 ms 256 KB
challenge_04 1 ms 256 KB
rand_01 1 ms 256 KB
rand_02 1 ms 256 KB
rand_03 1 ms 256 KB
rand_04 1 ms 256 KB
rand_pm1_01 1 ms 256 KB
rand_pm1_02 1 ms 256 KB
rand_pm1_03 1 ms 256 KB
rand_pm1_04 1 ms 256 KB