Submission #846966


Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
VI mq;
map<in,in> qc;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in n,q;
  cin>>n>>q;
  mq.resize(q);
  forn(i,q)
    cin>>mq[i];
  reverse(all(mq));
  in rr=1;
  for(in i=1;i<q;++i){
    if(mq[i]<mq[rr-1])
      mq[rr++]=mq[i];
  }
  mq.resize(rr);
  reverse(all(mq));
  qc[-mq.back()]=1;
  map<in,in>::iterator it;
  in id;
  while(1){
    it=qc.begin();
    if(-it->first<=mq[0])
      break;
    id=lower_bound(all(mq),-it->first)-mq.begin();
    --id;
    qc[-mq[id]]+=(-it->first)/mq[id]*it->second;
    qc[-((-it->first)%mq[id])]+=it->second;
    qc.erase(it);
  }
  in tt=0;
  fors(i,qc)
    tt+=i->second;
  tt-=qc[0];
  for(in i=1;i<=n;++i){
    cout<<tt<<"\n";
    tt-=qc[-i];
  }
  return 0;
}

Submission Info

Submission Time
Task E - Sequential operations on Sequence
User w4yneb0t
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1226 Byte
Status WA
Exec Time 294 ms
Memory 14336 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1400
Status
AC × 2
AC × 9
WA × 29
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 100 ms 7808 KB
02.txt WA 102 ms 7936 KB
03.txt WA 104 ms 7936 KB
04.txt WA 101 ms 7936 KB
05.txt WA 101 ms 7936 KB
06.txt WA 209 ms 12672 KB
07.txt WA 241 ms 12800 KB
08.txt WA 228 ms 12544 KB
09.txt WA 236 ms 11904 KB
10.txt WA 206 ms 12672 KB
11.txt WA 188 ms 12800 KB
12.txt WA 235 ms 12416 KB
13.txt WA 243 ms 12288 KB
14.txt WA 205 ms 12672 KB
15.txt WA 197 ms 12672 KB
16.txt WA 220 ms 12544 KB
17.txt WA 220 ms 12544 KB
18.txt WA 215 ms 12800 KB
19.txt WA 184 ms 12800 KB
20.txt WA 217 ms 12160 KB
21.txt AC 294 ms 7424 KB
22.txt WA 253 ms 14336 KB
23.txt WA 237 ms 8448 KB
24.txt WA 116 ms 8576 KB
25.txt WA 119 ms 8320 KB
26.txt AC 105 ms 7552 KB
27.txt AC 80 ms 7424 KB
28.txt AC 83 ms 7424 KB
29.txt AC 81 ms 7424 KB
30.txt WA 85 ms 7424 KB
31.txt AC 4 ms 256 KB
32.txt WA 62 ms 6656 KB
33.txt AC 4 ms 256 KB
34.txt WA 66 ms 6656 KB
35.txt WA 4 ms 256 KB
36.txt WA 4 ms 256 KB
s1.txt AC 4 ms 256 KB
s2.txt AC 4 ms 256 KB