Submission #1131206
Source Code Expand
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }
template <class... Args>
auto table(int n, Args... args) {
auto val = table(args...);
return vector<decltype(val)>(n, move(val));
}
struct yes_no : numpunct<char> {
string_type do_truename() const { return "Yes"; }
string_type do_falsename() const { return "No"; }
};
const int mod = 1e9 + 7;
void solve(ll N, vector<ll> x) {
int c = 0;
ll res = 1;
for (ll i: x) {
if (i <= c * 2) { res = (res * (c + 1)) % mod; }
else ++c;
}
while (c > 0) {
res = (res * c) % mod;
--c;
}
cout << res << endl;
}
int main() {
locale loc(locale(), new yes_no);
cout << boolalpha << setprecision(12) << fixed;
cout.imbue(loc);
ll N;
scanf("%lld", &N);
vector<ll> x(N-1+1);
for (int i = 0 ; i <= N-1 ; i++) {
scanf("%lld", &x[i]);
}
solve(N, x);
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Robot Racing |
User |
asi1024 |
Language |
C++14 (GCC 5.4.1) |
Score |
900 |
Code Size |
1826 Byte |
Status |
AC |
Exec Time |
14 ms |
Memory |
1792 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:76:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &N);
^
./Main.cpp:79:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld", &x[i]);
^
Judge Result
Set Name |
Sample |
Subtask |
All |
Score / Max Score |
0 / 0 |
500 / 500 |
400 / 400 |
Status |
|
|
|
Set Name |
Test Cases |
Sample |
0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
Subtask |
0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt |
All |
0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt |
Case Name |
Status |
Exec Time |
Memory |
0_00.txt |
AC |
1 ms |
256 KB |
0_01.txt |
AC |
1 ms |
256 KB |
0_02.txt |
AC |
1 ms |
256 KB |
0_03.txt |
AC |
1 ms |
256 KB |
1_00.txt |
AC |
1 ms |
256 KB |
1_01.txt |
AC |
1 ms |
256 KB |
1_02.txt |
AC |
1 ms |
256 KB |
1_03.txt |
AC |
1 ms |
256 KB |
1_04.txt |
AC |
1 ms |
256 KB |
1_05.txt |
AC |
1 ms |
256 KB |
1_06.txt |
AC |
1 ms |
256 KB |
1_07.txt |
AC |
1 ms |
256 KB |
1_08.txt |
AC |
1 ms |
256 KB |
1_09.txt |
AC |
1 ms |
256 KB |
1_10.txt |
AC |
1 ms |
256 KB |
2_00.txt |
AC |
11 ms |
1792 KB |
2_01.txt |
AC |
12 ms |
1792 KB |
2_02.txt |
AC |
14 ms |
1792 KB |
2_03.txt |
AC |
12 ms |
1792 KB |
2_04.txt |
AC |
12 ms |
1792 KB |
2_05.txt |
AC |
12 ms |
1792 KB |
2_06.txt |
AC |
12 ms |
1792 KB |
2_07.txt |
AC |
12 ms |
1792 KB |
2_08.txt |
AC |
12 ms |
1792 KB |
2_09.txt |
AC |
12 ms |
1792 KB |
2_10.txt |
AC |
12 ms |
1792 KB |
2_11.txt |
AC |
13 ms |
1792 KB |
2_12.txt |
AC |
13 ms |
1792 KB |