ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#183239 | #3290. Mancala 游戏 | Koicy | 100 | 447ms | 16880kb | C++11 | 1.7kb | 2023-08-08 11:29:32 | 2023-08-08 12:40:10 |
answer
// Please submit with C++17! It's best to use C++20 or higher version.
// By Koicy (https://koicy.ly)
// rbtree ([email protected])
// Only one ace left.
#include <algorithm>
#include <array>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define _CONSOLE 0
// #define EFILE ""
using namespace std;
using tp = long long;
constexpr tp ZERO = 0, ONE = 1, INF32 = -1u >> 2, INF = -1ull >> 2;
template <typename _Type, size_t _Size>
struct mray : array<_Type, _Size + 9> {
_Type& operator[](size_t index) { return this->at(index); }
};
// Defines
// Constants
// Classes
// Typedeves
// Variables
bool g;
tp n, cnt;
// Arraies
mray<tp, 2000000> a, f;
// Functions
void MIST() {
}
// :/
void STRUGGLING([[maybe_unused]] tp TEST_NUMBER) {
cin >> n;
for (tp i = 1; i <= n; ++i) cin >> a[i];
for (tp i = n; i >= 1; --i) f[i] = f[i + 1] + (a[i] <= i) * (a[i] + f[i + 1]) / i;
for (tp i = 1; i <= n; ++i) g |= a[i] > i;
for (tp i = n; i >= 1; --i) g |= a[i] <= i && (a[i] + f[i + 1]) % i;
cout << f[1] + g << '\n';
}
#include <fstream>
signed main() {
tp t = 0, _t = 1;
cin.tie(0)->sync_with_stdio(0);
#if !_CONSOLE
#ifdef _LOCAL
static ifstream _in("input.txt");
cin.rdbuf(_in.rdbuf());
#else
#ifdef EFILE
static ifstream _in(EFILE ".in");
static ofstream _out(EFILE ".out");
cin.rdbuf(_in.rdbuf());
cout.rdbuf(_out.rdbuf());
#endif
#endif
#endif
// cin >> _t;
MIST();
while (t < _t) STRUGGLING(++t);
return 0;
}
//*/
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
4 0 1 100 4
output:
5
result:
ok 1 number(s): "5"
Test #3:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
3 1 1 3
output:
5
result:
ok 1 number(s): "5"
Test #4:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
4 1 3 3 4
output:
6
result:
ok 1 number(s): "6"
Test #5:
score: 5
Accepted
time: 0ms
memory: 1252kb
input:
5 1 2 0 3 5
output:
10
result:
ok 1 number(s): "10"
Test #6:
score: 5
Accepted
time: 2ms
memory: 1252kb
input:
6 0 2 0 3 5 7
output:
9
result:
ok 1 number(s): "9"
Test #7:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
7 1 2 3 4 5 1 7
output:
18
result:
ok 1 number(s): "18"
Test #8:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
200 1 1 4 3 5 1 7 10 9 10 11 16 13 11 22 6 17 18 19 30 21 27 23 24 25 26 28 28 37 2 31 19 25 35 35 1...
output:
3162
result:
ok 1 number(s): "3162"
Test #9:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
250 0 2 1 4 5 6 7 12 9 10 11 12 17 8 15 16 14 18 19 20 15 7 7 4 25 26 30 28 29 30 31 37 33 34 48 36 ...
output:
6879
result:
ok 1 number(s): "6879"
Test #10:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
280 1 2 3 4 5 6 7 8 4 11 13 12 13 14 6 11 17 18 21 20 28 1 3 31 4 13 33 9 10 11 7 32 20 34 42 46 3 3...
output:
8100
result:
ok 1 number(s): "8100"
Test #11:
score: 5
Accepted
time: 0ms
memory: 1256kb
input:
290 0 3 3 6 5 6 7 0 5 10 9 12 13 14 15 24 22 18 11 20 21 4 23 11 34 26 28 15 29 30 12 32 5 34 44 12 ...
output:
4541
result:
ok 1 number(s): "4541"
Test #12:
score: 5
Accepted
time: 0ms
memory: 1260kb
input:
300 1 2 0 4 5 6 7 0 9 2 9 6 13 2 15 24 12 18 3 20 21 22 28 9 25 39 27 28 29 30 19 32 33 4 16 41 43 3...
output:
11338
result:
ok 1 number(s): "11338"
Test #13:
score: 5
Accepted
time: 0ms
memory: 1260kb
input:
300 1 2 4 4 3 6 7 8 9 10 1 17 0 20 15 16 17 10 3 26 24 31 7 15 9 26 8 28 33 42 31 41 33 34 35 18 37 ...
output:
6990
result:
ok 1 number(s): "6990"
Test #14:
score: 5
Accepted
time: 0ms
memory: 1280kb
input:
1800 0 3 3 1 7 9 7 8 9 10 2 0 13 14 18 16 17 18 19 27 21 8 23 24 25 26 27 28 29 30 31 32 33 36 35 37...
output:
130199
result:
ok 1 number(s): "130199"
Test #15:
score: 5
Accepted
time: 0ms
memory: 1288kb
input:
1900 0 2 3 4 5 3 2 5 9 10 4 12 13 14 15 6 17 18 19 23 25 1 23 24 25 27 27 3 7 30 31 32 33 34 12 54 3...
output:
307557
result:
ok 1 number(s): "307557"
Test #16:
score: 5
Accepted
time: 0ms
memory: 1292kb
input:
2000 1 1 3 3 5 7 7 8 9 0 11 12 13 14 15 8 21 2 20 20 21 21 23 24 23 26 10 2 14 6 31 29 33 34 38 36 3...
output:
286998
result:
ok 1 number(s): "286998"
Test #17:
score: 5
Accepted
time: 15ms
memory: 2820kb
input:
100000 1 2 4 4 5 6 8 8 9 10 2 8 13 21 18 16 20 18 19 20 21 22 11 27 18 26 27 28 29 30 31 0 38 34 35 ...
output:
262013086
result:
ok 1 number(s): "262013086"
Test #18:
score: 5
Accepted
time: 129ms
memory: 13756kb
input:
800000 1 0 3 4 5 6 7 7 9 1 11 12 14 14 19 16 8 18 12 20 21 15 16 11 25 34 30 40 29 30 14 32 1 23 10 ...
output:
17726464510
result:
ok 1 number(s): "17726464510"
Test #19:
score: 5
Accepted
time: 148ms
memory: 15320kb
input:
900000 1 2 3 5 5 1 7 8 9 15 8 6 13 14 8 16 17 6 9 3 21 29 23 24 25 10 22 10 10 8 33 32 33 17 28 29 1...
output:
19943656410
result:
ok 1 number(s): "19943656410"
Test #20:
score: 5
Accepted
time: 153ms
memory: 16880kb
input:
1000000 0 2 3 1 5 6 7 8 9 10 9 12 13 14 15 16 17 18 19 20 21 2 33 24 7 26 2 28 29 7 31 32 14 34 15 3...
output:
38517338601
result:
ok 1 number(s): "38517338601"