Submission #1277413
Source Code Expand
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <cstring>
#include <numeric>
// C++11-compatible FastIO
namespace FastIO{static constexpr size_t E=(1<<17);static constexpr size_t T=23
,A=334;static constexpr char O[]="%.16f";FILE*e=stdin,*t=stdout;char a[E|1],*o,
*i;char n[E|1],*s,*h;inline size_t r(){size_t g=fread(a,1,E,e);*(i=a+g)=0;o=a;
return g;}inline size_t d(){std::ptrdiff_t g=i-o;if(a+g>=o){return 0;}memcpy(a,
o,g);size_t v=fread(a+g,1,E-g,e);*(i=a+(g+=v))=0;o=a;return v;}inline void l(d\
ouble&g){if(*o==0&&r()){g=0;return;}char*b;g=strtod(o,&b);while(b==o){if(!r()){
g=0;return;}g=strtod(o,&b);}if(b==i&&d()){g=strtod(a,&b);}o=b;}inline void l(c\
har&g){if(*o==0){r();}if((g=*o)!=0){++o;}}inline void l(char*g){while(1){if(*o
==0&&!r()){*g=0;return;}if(*o<=' '){++o;}else{break;}}for(char*b=o;;++o){if(*o
==0){memcpy(g,b,o-b);g+=o-b;if(!r()){*g=0;return;}b=o;}else if(*o<=' '){memcpy(
g,b,o-b);g+=o-b;*g=0;return;}}}template<class N>inline void l(N&g,typename std
::enable_if<std::is_signed<N>::value>::type*y=0){g=0;int p=0;if(o+T>=i){d();}w\
hile(*o<'-'){++o;}if(*o=='-'){p=1;++o;}do{g=g*10+*o-'0';}while(*++o>='0');++o;
if(p){g=-g;}}template<class N>inline void l(N&g,typename std::enable_if<!std::
is_signed<N>::value>::type*y=0){g=0;if(o+T>=i){d();}while(*o<'0'){++o;}do{g=g*
10+*o-'0';}while(*++o>='0');++o;}inline void c(){while((*o!=0||r())&&*o++<=' ')
{}}inline void c(char g){while((*o!=0||r())&&*o++<=' '){}}inline void u(){fwri\
te(n,1,s-n,t);s=n;}inline void m(char g){if(s+1>=h)u();*s++=g;}inline void m(c\
onst char*g){size_t y=strlen(g);if(s+y>=h){u();}if(s+y>=h){fwrite(g,1,y,t);}el\
se{memcpy(s,g,y);s+=y;}}template<size_t N>inline void m(const char(&g)[N]){m(&g
[0]);}inline void m(double g){char y[A];size_t p=snprintf(y,A,O,g);char*b=s+p;
if(b>=h){u();b=n+p;}memcpy(s,y,p);s=b;}template<class N>inline void m(N g,type\
name std::enable_if<std::is_signed<N>::value>::type*y=0){if(s+T>=h){u();}if(g==
0){*s++='0';return;}char k[T],*j=k+T,*x=j;if(g<0){*s++='-';g=-g;}do{*--j=g%10+
'0';g/=10;}while(g);memcpy(s,j,x-j);s+=x-j;}template<class N>inline void m(N g,
typename std::enable_if<!std::is_signed<N>::value>::type*y=0){if(s+T>=h){u();}
if(g==0){*s++='0';return;}char v[T],*k=v+T,*j=k;do{*--k=g%10+'0';g/=10;}while(g
);memcpy(s,k,j-k);s+=j-k;}struct Scanner{Scanner(){o=a;i=a+E;r();}template<cla\
ss Z>inline void scan(Z&&z){l(z);}template<class Z,class...Q>inline void scan(Z
&&z,Q&&...q){l(z);scan(q...);}};struct Printer{Printer(){s=n;h=n+E;}~Printer(){
u();}template<class Z>inline void print(Z z){m(z);}template<class Z,class...Q>
inline void print(Z z,Q...q){m(z);print(q...);}template<class Z>inline void pr\
intln(Z z){m(z);m('\n');}};}
FastIO::Scanner cin;
int period[485];
int main() {
int n;
cin.scan(n);
for (int i=0; i<n; ++i) {
unsigned s, e;
cin.scan(s, e);
++period[s/100*12+s%100/5];
--period[e/100*12+(e%100+4)/5];
}
bool is_opened=period[0];
if (is_opened)
printf("0000-");
for (int i=1; i<=480; ++i) {
period[i] += period[i-1];
if (is_opened && !period[i]) {
printf("%04d\n", i/12*100+i%12*5);
is_opened = false;
} else if (!is_opened && period[i]) {
printf("%04d-", i/12*100+i%12*5);
is_opened = true;
}
}
return 0;
}
Submission Info
Submission Time |
|
Task |
D - 感雨時刻の整理 |
User |
rsk0315 |
Language |
C++14 (GCC 5.4.1) |
Score |
100 |
Code Size |
3358 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Judge Result
Set Name |
all |
Score / Max Score |
100 / 100 |
Status |
|
Set Name |
Test Cases |
all |
00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, cho_cho_chokudai.txt, chokudai_ga_cho.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt |
Case Name |
Status |
Exec Time |
Memory |
00_sample_01.txt |
AC |
0 ms |
128 KB |
00_sample_02.txt |
AC |
1 ms |
128 KB |
00_sample_03.txt |
AC |
1 ms |
128 KB |
cho_cho_chokudai.txt |
AC |
1 ms |
256 KB |
chokudai_ga_cho.txt |
AC |
1 ms |
256 KB |
test_01.txt |
AC |
1 ms |
128 KB |
test_02.txt |
AC |
1 ms |
128 KB |
test_03.txt |
AC |
1 ms |
128 KB |
test_04.txt |
AC |
1 ms |
128 KB |
test_05.txt |
AC |
1 ms |
128 KB |
test_06.txt |
AC |
1 ms |
128 KB |
test_07.txt |
AC |
1 ms |
128 KB |
test_08.txt |
AC |
1 ms |
128 KB |
test_09.txt |
AC |
1 ms |
128 KB |
test_10.txt |
AC |
1 ms |
128 KB |
test_11.txt |
AC |
1 ms |
128 KB |
test_12.txt |
AC |
1 ms |
128 KB |
test_13.txt |
AC |
1 ms |
128 KB |
test_14.txt |
AC |
1 ms |
128 KB |
test_15.txt |
AC |
1 ms |
128 KB |
test_16.txt |
AC |
1 ms |
128 KB |
test_17.txt |
AC |
1 ms |
128 KB |
test_18.txt |
AC |
1 ms |
128 KB |
test_19.txt |
AC |
1 ms |
128 KB |
test_20.txt |
AC |
1 ms |
128 KB |
test_21.txt |
AC |
1 ms |
256 KB |
test_22.txt |
AC |
1 ms |
256 KB |
test_23.txt |
AC |
1 ms |
256 KB |
test_24.txt |
AC |
1 ms |
256 KB |
test_25.txt |
AC |
1 ms |
256 KB |
test_26.txt |
AC |
1 ms |
256 KB |
test_27.txt |
AC |
1 ms |
256 KB |
test_28.txt |
AC |
1 ms |
256 KB |
test_29.txt |
AC |
1 ms |
128 KB |
test_30.txt |
AC |
1 ms |
128 KB |
test_31.txt |
AC |
1 ms |
256 KB |
test_32.txt |
AC |
1 ms |
128 KB |
test_33.txt |
AC |
1 ms |
256 KB |
test_34.txt |
AC |
1 ms |
128 KB |
test_35.txt |
AC |
1 ms |
128 KB |
test_36.txt |
AC |
1 ms |
256 KB |
test_37.txt |
AC |
1 ms |
256 KB |
test_38.txt |
AC |
1 ms |
256 KB |
test_39.txt |
AC |
1 ms |
256 KB |
test_40.txt |
AC |
1 ms |
256 KB |
test_41.txt |
AC |
1 ms |
256 KB |
test_42.txt |
AC |
1 ms |
256 KB |
test_43.txt |
AC |
1 ms |
256 KB |