Submission #1082192
Source Code Expand
#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 avl; VI psm; int main(){ ios::sync_with_stdio(0); cin.tie(0); in n,m; avl.resize(m+3); psm.resize(m+3); cin>>n>>m; in l,r; in tlm=1; while((tlm+1)*(tlm+1)<m) ++tlm; in nxt; in nr,nl; forn(zz,n){ cin>>l>>r; for(in i=1;i<=tlm;++i){ if(r/i!=(l-1)/i) ++avl[i]; } nxt=tlm+1; for(in hts=tlm+4;hts>=1;--hts){ nl=(l-1)/hts+1; nr=r/hts; nl=max(nl,nxt); if(nl>nr) continue; ++psm[nl]; --psm[nr+1]; nxt=nr+1; } } for(in i=1;i<=m;++i){ psm[i]+=psm[i-1]; avl[i]+=psm[i]; cout<<avl[i]<<"\n"; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Snuke Line |
User | w4yneb0t |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1124 Byte |
Status | RE |
Exec Time | 569 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 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, 37.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | RE | 144 ms | 256 KB |
00_example_02.txt | RE | 114 ms | 256 KB |
01.txt | RE | 115 ms | 256 KB |
02.txt | RE | 115 ms | 256 KB |
03.txt | RE | 113 ms | 256 KB |
04.txt | AC | 3 ms | 256 KB |
05.txt | RE | 113 ms | 256 KB |
06.txt | RE | 114 ms | 256 KB |
07.txt | AC | 3 ms | 256 KB |
08.txt | RE | 114 ms | 256 KB |
09.txt | AC | 3 ms | 256 KB |
10.txt | RE | 115 ms | 256 KB |
11.txt | RE | 113 ms | 256 KB |
12.txt | RE | 114 ms | 256 KB |
13.txt | RE | 113 ms | 256 KB |
14.txt | RE | 115 ms | 256 KB |
15.txt | RE | 114 ms | 256 KB |
16.txt | RE | 114 ms | 256 KB |
17.txt | RE | 113 ms | 256 KB |
18.txt | RE | 569 ms | 256 KB |
19.txt | RE | 113 ms | 256 KB |
20.txt | RE | 114 ms | 256 KB |
21.txt | RE | 114 ms | 256 KB |
22.txt | RE | 116 ms | 384 KB |
23.txt | RE | 117 ms | 256 KB |
24.txt | RE | 115 ms | 256 KB |
25.txt | RE | 114 ms | 256 KB |
26.txt | RE | 115 ms | 256 KB |
27.txt | RE | 116 ms | 256 KB |
28.txt | RE | 114 ms | 256 KB |
29.txt | RE | 113 ms | 256 KB |
30.txt | RE | 118 ms | 256 KB |
31.txt | RE | 114 ms | 256 KB |
32.txt | RE | 114 ms | 256 KB |
33.txt | RE | 114 ms | 256 KB |
34.txt | RE | 115 ms | 256 KB |
35.txt | RE | 115 ms | 256 KB |
36.txt | AC | 3 ms | 256 KB |
37.txt | RE | 113 ms | 256 KB |