Submission #1131238
Source Code Expand
#include <bits/stdc++.h>
#define FOR(i,n) for(lli i=0;i<(lli)(n);++i)
#define FORU(i,j,k) for(lli i=(j);i<=(lli)(k);++i)
#define FORD(i,j,k) for(lli i=(j);i>=(lli)(k);--i)
#define pb push_back
#define mt make_tuple
using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using vi = vector<lli>;
using vvi = vector<vi>;
using pii = tuple<lli, lli>;
using vii = vector<pii>;
using vvii = vector<vii>;
#define X(a) get<0>(a)
#define Y(a) get<1>(a)
#define Z(a) get<2>(a)
string TYPE(const int*) { return "%d"; }
string TYPE(const lli*) { return "%lld"; }
string TYPE(const char*) { return "%c"; }
string TYPE(const char**) { return "%s"; }
string TYPE(const unsigned int*) { return "%u"; }
const int MAX_BUF = 100*1000+42;
char buf[MAX_BUF];
void RD() {}
template<typename T, typename... Args>
void RD(T* v, Args... args)
{
scanf((" " + TYPE(v)).c_str(), v);
RD(args...);
}
template<typename... Args>
void RD(string* v, Args... args)
{
scanf(" %s", buf);
(*v) = buf;
RD(args...);
}
void PR(bool nl = true)
{ if(nl) printf("\n"); }
template<typename T, typename... Args>
void PR(bool nl, T v, Args... args)
{
printf((TYPE(&v) + " ").c_str(), v);
PR(nl, args...);
}
template<typename... Args>
void PR(bool nl, string& v, Args... args)
{
printf("%s", v.c_str());
PR(nl, args...);
}
template<typename... Args>
void PR(Args... args)
{ PR(true, args...); }
const long long int oo = 1000*1000*1000;
struct Coord {
int x, y;
Coord(int x = 0, int y = 0) : x(x), y(y) {}
Coord operator + (const Coord& droite) const
{ return Coord(x + droite.x, y + droite.y); }
};
struct AB {
int k; vector<lli> arbre;
AB(int _k = 20, lli def = 0) { k = _k;
FOR(i, 1 << k)
arbre.push_back(i < (1 << (k-1)) ? 0LL : def);
FORD(i, ((1 << (k-1)) - 1), 1)
arbre[i] = arbre[i << 1] + arbre[(i << 1) ^ 1];
}
void set(int i, lli x) { int feuille = i + (1 << (k-1));
arbre[feuille] = x;
iset(feuille >> 1);
}
void iset(int noeud) {
if(noeud) {
arbre[noeud] = arbre[noeud << 1] + arbre[(noeud << 1) ^ 1];
iset(noeud >> 1);
} }
lli sum(int deb, int fin, int noeud = 1, int p = 0, int q = -1) {
if(q < p) q = 1 << (k-1);
if(deb <= p && q <= fin) return arbre[noeud];
if(deb >= q || fin <= p) return 0LL;
int mil = (p + q) / 2;
return sum(deb, fin, noeud << 1, p, mil) + sum(deb, fin, (noeud << 1) ^ 1, mil, q);
}
};
const lli MOD = 1E9+7;
lli x[100*1000+42];
lli v[100*1000+42];
lli r = 1;
lli nb = 0;
lli s;
int main()
{
int n;
RD(&n);
FOR(i, n)
{
RD(x+i);
++v[i-nb];
--v[i+1];
nb += (nb+1) <= (x[i]+1)/2;
}
lli s = 0;
FOR(i, n)
{
s += v[i];
r = (r * s) % MOD;
}
PR(r);
return 0;
}
Submission Info
Submission Time
2017-02-25 21:15:13+0900
Task
A - Robot Racing
User
Akulen
Language
C++14 (GCC 5.4.1)
Score
900
Code Size
3067 Byte
Status
AC
Exec Time
26 ms
Memory
1792 KB
Compile Error
./Main.cpp: In function ‘void RD(T*, Args ...) [with T = int; Args = {}]’:
./Main.cpp:38:5: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf((" " + TYPE(v)).c_str(), v);
^
./Main.cpp: In function ‘void RD(T*, Args ...) [with T = long long int; Args = {}]’:
./Main.cpp:38:5: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
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
24 ms
1792 KB
2_01.txt
AC
24 ms
1792 KB
2_02.txt
AC
26 ms
1792 KB
2_03.txt
AC
24 ms
1792 KB
2_04.txt
AC
24 ms
1792 KB
2_05.txt
AC
24 ms
1792 KB
2_06.txt
AC
24 ms
1792 KB
2_07.txt
AC
24 ms
1792 KB
2_08.txt
AC
24 ms
1792 KB
2_09.txt
AC
24 ms
1792 KB
2_10.txt
AC
24 ms
1792 KB
2_11.txt
AC
26 ms
1792 KB
2_12.txt
AC
26 ms
1792 KB