Submission #2493732


Source Code Expand

#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define ll long long
#define inf 1000000001
using namespace std;
int read(){
	char ch=getchar();int x=0,op=1;
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') op=-1;
	for (;isdigit(ch);ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
void write(ll a){
	if (a<0) putchar('-'),a=-a;
	if (a>=10) write(a/10);putchar(a%10+'0');
}
#define N 100005
int n,m;ll ans[N];
int main(){
	n=read(),m=read();
	rep (i,1,n){
		int l=read()-1,r=read(),last,j;
		for (j=1;j<=l;j=last+1){
			last=min(l/(l/j),r/(r/j));//cerr<<last<<' ';
			if (r/j-l/j>0) ans[j]++,ans[last+1]--;
		}
		if (j<=r) ans[j]++,ans[r+1]--;
	}
	rep (i,1,m) ans[i]+=ans[i-1],write(ans[i]),puts("");
	return 0;
}

Submission Info

Submission Time
Task E - Snuke Line
User Meetc
Language C++14 (GCC 5.4.1)
Score 700
Code Size 949 Byte
Status AC
Exec Time 1002 ms
Memory 1664 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 2
AC × 39
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 AC 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
01.txt AC 1 ms 256 KB
02.txt AC 1 ms 256 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt AC 1 ms 256 KB
10.txt AC 1 ms 256 KB
11.txt AC 604 ms 768 KB
12.txt AC 698 ms 1664 KB
13.txt AC 268 ms 384 KB
14.txt AC 223 ms 256 KB
15.txt AC 223 ms 256 KB
16.txt AC 561 ms 640 KB
17.txt AC 696 ms 1536 KB
18.txt AC 180 ms 256 KB
19.txt AC 695 ms 1664 KB
20.txt AC 701 ms 1664 KB
21.txt AC 696 ms 1664 KB
22.txt AC 698 ms 1664 KB
23.txt AC 697 ms 1664 KB
24.txt AC 891 ms 1280 KB
25.txt AC 552 ms 384 KB
26.txt AC 309 ms 256 KB
27.txt AC 1002 ms 1408 KB
28.txt AC 591 ms 384 KB
29.txt AC 928 ms 1408 KB
30.txt AC 773 ms 384 KB
31.txt AC 189 ms 1664 KB
32.txt AC 181 ms 384 KB
33.txt AC 172 ms 256 KB
34.txt AC 543 ms 1664 KB
35.txt AC 545 ms 1664 KB
36.txt AC 1 ms 256 KB
37.txt AC 4 ms 1152 KB