Contest Duration: - (local time) (100 minutes) Back to Home

Submission #1467870

Source Code Expand

Copy
```#define  _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <deque>
#include <queue>
#include <iomanip>
#include <fstream>
#include <string>
#include <climits>

typedef long long ll;
typedef long double ld;

#define fi(n) for(int i = 0; i < (n); i++)
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define RFOR(i, k, n) for(int i = (k); i >= (n); i--)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = INT_MAX;
const int mod = 1e9 + 7;
const long long LINF = LLONG_MAX;

using namespace std;

int main()
{
int n;
cin >> n;
queue<pair<ll, int>> que;
set<int> mbcu;
fi(n)
{
ll x;
cin >> x;
que.push({ x, i });
mbcu.insert(i);
}
ll answ = 0, pl = 0;
vector<ll> m(n);

while (!que.empty() && !mbcu.empty())
{
ll v = que.front().first;
int i = que.front().second;
que.pop();
v += answ - m[i];

if (v >= n)
{
ll newansw = v / n;
v = v % n;
answ += newansw;
m[i] = answ;
mbcu.insert(i);
que.push({ v, i });
}
else
{
mbcu.erase(i);
m[i] = answ;
que.push({ v, i });
}
}

cout << answ << endl;

return 0;
}```

#### Submission Info

Submission Time 2017-07-29 22:16:19+0900 E - Decrease (Judge ver.) kostyayatsok C++14 (GCC 5.4.1) 600 1347 Byte AC 3 ms 256 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
 AC × 5
 AC × 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 AC 1 ms 256 KB
example1 AC 1 ms 256 KB
example2 AC 1 ms 256 KB
example3 AC 1 ms 256 KB
example4 AC 1 ms 256 KB
maxrand0 AC 1 ms 256 KB
maxrand1 AC 3 ms 256 KB
maxrand2 AC 1 ms 256 KB
maxrand3 AC 3 ms 256 KB
maxrand4 AC 1 ms 256 KB
maxrand5 AC 2 ms 256 KB
maxrand6 AC 1 ms 256 KB
maxrand7 AC 3 ms 256 KB
maxrand8 AC 1 ms 256 KB
maxrand9 AC 2 ms 256 KB
rand0 AC 1 ms 256 KB
rand1 AC 2 ms 256 KB
rand2 AC 2 ms 256 KB
rand3 AC 2 ms 256 KB
rand4 AC 1 ms 256 KB
rand5 AC 1 ms 256 KB
rand6 AC 1 ms 256 KB
rand7 AC 2 ms 256 KB
rand8 AC 1 ms 256 KB
rand9 AC 1 ms 256 KB
small0 AC 1 ms 256 KB
small1 AC 1 ms 256 KB
small2 AC 1 ms 256 KB
small3 AC 1 ms 256 KB
small4 AC 1 ms 256 KB
small5 AC 1 ms 256 KB
small6 AC 1 ms 256 KB
small7 AC 1 ms 256 KB
small8 AC 1 ms 256 KB
small9 AC 1 ms 256 KB