Submission #1872154
Source Code Expand
/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // _oo0oo_ // // o8888888o // // 88" . "88 ------ hzt1 // // (| -_- |) // // 0\ = /0 // // ___/`---'\___ // // .' \| |// '. // // / \||| : |||// \ // // / _||||| -:- |||||- \ // // | | \ - /// | | // // | \_| ''\---/'' |_/ | // // \ .-\__ '-' ___/-. / // // ___'. .' /--.--\ `. .'___ // // ."" '< `.___\_<|>_/___.' >' "". // // | | : `- \`.;`\ _ /`;.`/ - ` : | | // // \ \ `_. \_ __\ /__ _/ .-` / / // // =====`-.____`.___ \_____/___.-`___.-'===== // // `=---=' // // // // // // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // // // God-He Bless All. // // This Code Will Never Explode. // // // // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// #include<cstdio> #include<cstring> #include<cctype> #include<algorithm> #include<vector> #define pb push_back #define mp make_pair #define xx first #define yy second #define rep(i,a,b) for(int i=(a),i##_end_=(b);i<=i##_end_;i++) #define dwn(i,a,b) for(int i=(a),i##_end_=(b);i>=i##_end_;i--) using namespace std; const int Size=1<<16; char buffer[Size],*head,*tail; inline char Getchar() { if(head==tail) { int l=fread(buffer,1,Size,stdin); tail=(head=buffer)+l; } if(head==tail) return -1; return *head++; } typedef long long ll; inline ll read() { ll x=0,f=1;char c=Getchar(); for(;!isdigit(c);c=Getchar()) if(c=='-') f=-1; for(;isdigit(c);c=Getchar()) x=x*10+c-'0'; return x*f; } typedef pair<int,int> pii; const int maxn=100010; int n,m,top; ll ans[maxn],A[maxn],cnt[maxn]; int main() { n=read();m=read(); A[++top]=n; rep(i,1,m) { ll x=read(); while(top&&A[top]>=x) top--; A[++top]=x; } cnt[top]=1; dwn(i,top,1) { ll x=A[i];int t; while(t=lower_bound(A,A+i+1,x)-A-1) { cnt[t]+=(ll)cnt[i]*(x/A[t]); x%=A[t]; } ans[x]+=cnt[i]; } dwn(i,n-1,1) ans[i]+=ans[i+1]; rep(i,1,n) printf("%lld\n",ans[i]); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Sequential operations on Sequence |
User | wzj52501 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 3072 Byte |
Status | RE |
Exec Time | 107 ms |
Memory | 3968 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 15 ms | 2304 KB |
02.txt | AC | 15 ms | 2432 KB |
03.txt | AC | 15 ms | 2432 KB |
04.txt | AC | 15 ms | 2432 KB |
05.txt | AC | 15 ms | 2432 KB |
06.txt | AC | 24 ms | 3968 KB |
07.txt | RE | 101 ms | 1920 KB |
08.txt | RE | 100 ms | 1920 KB |
09.txt | AC | 28 ms | 3968 KB |
10.txt | RE | 107 ms | 2432 KB |
11.txt | AC | 23 ms | 3968 KB |
12.txt | AC | 27 ms | 3968 KB |
13.txt | AC | 28 ms | 3968 KB |
14.txt | AC | 24 ms | 3968 KB |
15.txt | RE | 106 ms | 2432 KB |
16.txt | RE | 100 ms | 1792 KB |
17.txt | RE | 102 ms | 2048 KB |
18.txt | RE | 101 ms | 1920 KB |
19.txt | RE | 106 ms | 2560 KB |
20.txt | RE | 101 ms | 1792 KB |
21.txt | RE | 98 ms | 1024 KB |
22.txt | RE | 102 ms | 2048 KB |
23.txt | RE | 100 ms | 1024 KB |
24.txt | AC | 19 ms | 3840 KB |
25.txt | AC | 19 ms | 3712 KB |
26.txt | AC | 16 ms | 2688 KB |
27.txt | AC | 10 ms | 1152 KB |
28.txt | AC | 10 ms | 1152 KB |
29.txt | AC | 10 ms | 1152 KB |
30.txt | AC | 10 ms | 1152 KB |
31.txt | AC | 1 ms | 128 KB |
32.txt | AC | 9 ms | 1152 KB |
33.txt | AC | 1 ms | 128 KB |
34.txt | RE | 96 ms | 128 KB |
35.txt | AC | 1 ms | 128 KB |
36.txt | RE | 97 ms | 128 KB |
s1.txt | AC | 0 ms | 128 KB |
s2.txt | AC | 1 ms | 128 KB |