Submission #846128


Source Code Expand

Copy
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL an[SIZE],d[SIZE],cc[SIZE];
int main(){
 DRII(N,Q);
 d[Q]=N;
 REP(i,Q)cin>>d[Q-i-1];
 {
  int it=1;
  REPP(i,1,Q+1){
   if(d[i]<d[it-1])d[it++]=d[i];
  }
  Q=it;
  reverse(d,d+Q);
 }
 for(int i=Q-1;i>0;i--){
  LL me=cc[i]+1;
  int it=i;
  LL now=d[i];
  while(it){
   cc[it-1]+=me*(now/d[it-1]);
   now%=d[it-1];
   it=upper_bound(d,d+it,now)-d;
  }
  an[now]+=me;
 }
 an[d[0]]+=cc[0];
 for(int i=N;i>0;i--)an[i]+=an[i+1];
 REPP(i,1,N+1)cout<<an[i]<<endl;
 return 0;
}

Submission Info

Submission Time
Task E - Sequential operations on Sequence
User dreamoon
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1567 Byte
Status WA
Exec Time 1998 ms
Memory 4480 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:11: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  DRII(N,Q);
           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1400
Status
AC × 1
WA × 1
AC × 3
WA × 35
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 WA 1998 ms 3200 KB
02.txt WA 1139 ms 3328 KB
03.txt WA 786 ms 3328 KB
04.txt WA 794 ms 3200 KB
05.txt WA 794 ms 3328 KB
06.txt WA 806 ms 4480 KB
07.txt WA 814 ms 4480 KB
08.txt WA 798 ms 4480 KB
09.txt WA 807 ms 4480 KB
10.txt WA 799 ms 4480 KB
11.txt WA 854 ms 4480 KB
12.txt WA 798 ms 4480 KB
13.txt WA 808 ms 4480 KB
14.txt WA 799 ms 4480 KB
15.txt WA 806 ms 4480 KB
16.txt WA 827 ms 4480 KB
17.txt WA 939 ms 4480 KB
18.txt WA 799 ms 4480 KB
19.txt WA 803 ms 4480 KB
20.txt WA 799 ms 4480 KB
21.txt WA 782 ms 2816 KB
22.txt WA 760 ms 4096 KB
23.txt WA 810 ms 4480 KB
24.txt WA 727 ms 4224 KB
25.txt WA 736 ms 4096 KB
26.txt WA 695 ms 2816 KB
27.txt WA 640 ms 2048 KB
28.txt WA 647 ms 2048 KB
29.txt WA 633 ms 2048 KB
30.txt AC 651 ms 2048 KB
31.txt WA 4 ms 256 KB
32.txt WA 582 ms 1280 KB
33.txt WA 4 ms 256 KB
34.txt AC 597 ms 2432 KB
35.txt WA 4 ms 256 KB
36.txt WA 4 ms 256 KB
s1.txt AC 5 ms 256 KB
s2.txt WA 4 ms 256 KB