Submission #1518345


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int n; long long a[55], ret;
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	while(true) {
		int ptr = max_element(a, a + n) - a;
		for(int j = 0; j < n; j++) {
			if(j != ptr) a[j] += a[ptr] / n;
		}
		ret += a[ptr] / n;
		a[ptr] %= n;
	}
	cout << ret << endl;
	return 0;
}

Submission Info

Submission Time
Task E - Decrease (Judge ver.)
User square1001
Language C++14 (GCC 5.4.1)
Score 0
Code Size 354 Byte
Status TLE
Exec Time 2103 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
TLE × 5
TLE × 35
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, maxrand3, maxrand4, maxrand5, maxrand6, maxrand7, maxrand8, maxrand9, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9, small0, small1, small2, small3, small4, small5, small6, small7, small8, small9
Case Name Status Exec Time Memory
example0 TLE 2103 ms 256 KB
example1 TLE 2103 ms 256 KB
example2 TLE 2103 ms 256 KB
example3 TLE 2103 ms 256 KB
example4 TLE 2103 ms 256 KB
maxrand0 TLE 2103 ms 256 KB
maxrand1 TLE 2103 ms 256 KB
maxrand2 TLE 2103 ms 256 KB
maxrand3 TLE 2103 ms 256 KB
maxrand4 TLE 2103 ms 256 KB
maxrand5 TLE 2103 ms 256 KB
maxrand6 TLE 2103 ms 256 KB
maxrand7 TLE 2103 ms 256 KB
maxrand8 TLE 2103 ms 256 KB
maxrand9 TLE 2103 ms 256 KB
rand0 TLE 2103 ms 256 KB
rand1 TLE 2103 ms 256 KB
rand2 TLE 2103 ms 256 KB
rand3 TLE 2103 ms 256 KB
rand4 TLE 2103 ms 256 KB
rand5 TLE 2103 ms 256 KB
rand6 TLE 2103 ms 256 KB
rand7 TLE 2103 ms 256 KB
rand8 TLE 2103 ms 256 KB
rand9 TLE 2103 ms 256 KB
small0 TLE 2103 ms 256 KB
small1 TLE 2103 ms 256 KB
small2 TLE 2103 ms 256 KB
small3 TLE 2103 ms 256 KB
small4 TLE 2103 ms 256 KB
small5 TLE 2103 ms 256 KB
small6 TLE 2103 ms 256 KB
small7 TLE 2103 ms 256 KB
small8 TLE 2103 ms 256 KB
small9 TLE 2103 ms 256 KB