Submission #1131286
Source Code Expand
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define TR(it,c) for( typeof(c.begin()) it = c.begin(); it != c.end(); ++it )
#define TRR(it,c) for( typeof(c.rbegin()) it = c.rbegin(); it != c.rend(); ++it
#define REP(i,a) for (int i = 0; i < (a); i++)
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define DRI(a) int a; scanf("%d", &a);
#define DRII(a, b) int a, b; scanf("%d %d", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c);
#define RI(a) scanf("%d", &a);
#define RII(a, b) scanf("%d %d", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define MM(arr, num) memset((arr), (num), sizeof((arr)))
#define DEB(x) cerr << ">>> " << (#x) << " -> " << (x) << endl;
#define DEBA(x,n) cerr << (#x) << " "; deba((x),(n));
void deba(int * a, int n){ cerr << "| "; REP(i,n) cerr << a[i] << " "; cerr << "|" << endl;}
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<30;
typedef long long ll;
typedef unsigned long long ull;
/*******************************************************/
ll mod = 1e9 + 7;
int a[123456];
int main() {
DRI(n);
REP(i,n) RI(a[i]);
ll out = 1;
ll lv = 0;
REP(i,n){
if(i>0){
int len = a[i];
int p = (i+1)-lv;
if( len- p < len/2 ){
out*= p;
out%= mod;
lv++;
}
}
}
FORD(i, n-lv, 1) {out*= i; out%= mod; }
cout << out << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Robot Racing |
User |
jamaisvu |
Language |
C++14 (GCC 5.4.1) |
Score |
900 |
Code Size |
1945 Byte |
Status |
AC |
Exec Time |
14 ms |
Memory |
640 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:30:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
#define DRI(a) int a; scanf("%d", &a);
^
./Main.cpp:55:3: note: in expansion of macro ‘DRI’
DRI(n);
^
./Main.cpp:33:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
#define RI(a) scanf("%d", &a);
^
./Main.cpp:56:12: note: in expansion of macro ‘RI’
REP(i,n) RI(a[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 |
12 ms |
640 KB |
2_01.txt |
AC |
12 ms |
640 KB |
2_02.txt |
AC |
14 ms |
640 KB |
2_03.txt |
AC |
12 ms |
640 KB |
2_04.txt |
AC |
12 ms |
640 KB |
2_05.txt |
AC |
12 ms |
640 KB |
2_06.txt |
AC |
12 ms |
640 KB |
2_07.txt |
AC |
12 ms |
640 KB |
2_08.txt |
AC |
12 ms |
640 KB |
2_09.txt |
AC |
12 ms |
640 KB |
2_10.txt |
AC |
12 ms |
640 KB |
2_11.txt |
AC |
14 ms |
640 KB |
2_12.txt |
AC |
14 ms |
640 KB |