Submission #1131178


Source Code Expand

#include <bits/stdc++.h>
 
#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 VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()
 
#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>
 
#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}
 
#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
 
#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb fflush(stdout)

 
using namespace std;

#define max_n 100005

int mod = 1e9 + 7;
lint ans = 1;

int main() {
	make(n);
	makev(v, n);
	sort(all(v));
	int jest = 0;
	FOR(i,0,n) {
		int maxi = v[i];
		jest++;
		if (jest > (maxi+1)/2 ) {
			ans = (ans * 1LL * jest) % mod;
			jest--;
		}  
	}
	FOR(i,1,jest+1) {
		ans = (ans * 1LL * i) % mod;
	}
	printf("%lld\n", ans);
}

Submission Info

Submission Time
Task A - Robot Racing
User fruwajacybyk
Language C++14 (GCC 5.4.1)
Score 900
Code Size 1937 Byte
Status AC
Exec Time 16 ms
Memory 892 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define make( x) int (x); scanf("%d",&(x));
                                           ^
./Main.cpp:47:2: note: in expansion of macro ‘make’
  make(n);
  ^
./Main.cpp:23:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define make( x) int (x); scanf("%d",&(x));
                                           ^
./Main.cpp:27:43: note: in expansion of macro ‘make’
 #define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
                                           ^
./Main.cpp:48:2: note: in expansion of macro ‘makev’
  makev(v, n);
  ^

Judge Result

Set Name Sample Subtask All
Score / Max Score 0 / 0 500 / 500 400 / 400
Status
AC × 4
AC × 14
AC × 28
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 13 ms 892 KB
2_01.txt AC 14 ms 892 KB
2_02.txt AC 16 ms 892 KB
2_03.txt AC 14 ms 892 KB
2_04.txt AC 14 ms 892 KB
2_05.txt AC 14 ms 892 KB
2_06.txt AC 14 ms 892 KB
2_07.txt AC 14 ms 892 KB
2_08.txt AC 14 ms 892 KB
2_09.txt AC 14 ms 892 KB
2_10.txt AC 14 ms 892 KB
2_11.txt AC 15 ms 892 KB
2_12.txt AC 15 ms 892 KB