AtCoder Regular Contest 010

Submission #638086

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(i=0;i<n;++i)
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define mp make_pair
#define pb push_back
#define fi first
#define sc second

int conv(int month, int day){
  int ret=0;
  int m=1;
  while(m<month){
    if(m==2) ret+=29;
    else if(m==4||m==6||m==9||m==11) ret+=30;
    else ret+=31;
    ++m;
  }

  return ret+day;
}

int main(int argc, char const *argv[]) {
  int i;

  int n;
  cin >>n;

  bool r[367];
  fill(r,r+367,false);

  //日曜日と土曜日
  for(i=1; i<=366; i+=7) r[i]=true;
  for(i=7; i<=366; i+=7) r[i]=true;

  rep(i,n){
    int m,d;
    scanf(" %d/%d",&m,&d);

    int t=conv(m,d);
    while(t<=365 && r[t]) ++t;
    r[t]=true;
  }

  int ans=0;
  int ct=0;
  for(i=1; i<=366; ++i){
    if(r[i]) ++ct;
    else ct=0;
    ans=max(ans,ct);
  }

  std::cout << ans << std::endl;
  return 0;
}

Submission

Task問題 B - 超大型連休
User nameユーザ名 imulan
Created time投稿日時
Language言語 C++11 (GCC 4.8.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1003 Byte
File nameファイル名
Exec time実行時間 39 ms
Memory usageメモリ使用量 924 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:40:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf(" %d/%d",&m,&d);
^

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,01_rand_00.txt,01_rand_01.txt,01_rand_02.txt,01_rand_03.txt,01_rand_04.txt,01_rand_05.txt,01_rand_06.txt,01_rand_07.txt,01_rand_08.txt,01_rand_09.txt,01_rand_10.txt,01_rand_11.txt,01_rand_12.txt,01_rand_13.txt,01_rand_14.txt,01_rand_15.txt,01_rand_16.txt,01_rand_17.txt,01_rand_18.txt,01_rand_19.txt,01_rand_20.txt,01_rand_21.txt,01_rand_22.txt,01_rand_23.txt,01_rand_24.txt,01_rand_25.txt,01_rand_26.txt,01_rand_27.txt,01_rand_28.txt,01_rand_29.txt,01_rand_30.txt,01_rand_31.txt,01_rand_32.txt,01_rand_33.txt,01_rand_34.txt,01_rand_35.txt,01_rand_36.txt,01_rand_37.txt,01_rand_38.txt,01_rand_39.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 28 ms 848 KB
00_sample_02.txt AC 27 ms 864 KB
00_sample_03.txt AC 27 ms 924 KB
00_sample_04.txt AC 28 ms 740 KB
01_rand_00.txt AC 27 ms 796 KB
01_rand_01.txt AC 27 ms 840 KB
01_rand_02.txt AC 28 ms 876 KB
01_rand_03.txt AC 29 ms 772 KB
01_rand_04.txt AC 28 ms 924 KB
01_rand_05.txt AC 29 ms 800 KB
01_rand_06.txt AC 25 ms 744 KB
01_rand_07.txt AC 27 ms 800 KB
01_rand_08.txt AC 28 ms 800 KB
01_rand_09.txt AC 27 ms 920 KB
01_rand_10.txt AC 34 ms 808 KB
01_rand_11.txt AC 28 ms 848 KB
01_rand_12.txt AC 27 ms 796 KB
01_rand_13.txt AC 28 ms 796 KB
01_rand_14.txt AC 28 ms 752 KB
01_rand_15.txt AC 29 ms 920 KB
01_rand_16.txt AC 26 ms 752 KB
01_rand_17.txt AC 28 ms 868 KB
01_rand_18.txt AC 25 ms 748 KB
01_rand_19.txt AC 28 ms 752 KB
01_rand_20.txt AC 27 ms 924 KB
01_rand_21.txt AC 28 ms 800 KB
01_rand_22.txt AC 26 ms 748 KB
01_rand_23.txt AC 39 ms 700 KB
01_rand_24.txt AC 27 ms 924 KB
01_rand_25.txt AC 27 ms 792 KB
01_rand_26.txt AC 28 ms 828 KB
01_rand_27.txt AC 28 ms 796 KB
01_rand_28.txt AC 28 ms 800 KB
01_rand_29.txt AC 27 ms 792 KB
01_rand_30.txt AC 27 ms 796 KB
01_rand_31.txt AC 25 ms 796 KB
01_rand_32.txt AC 25 ms 792 KB
01_rand_33.txt AC 29 ms 796 KB
01_rand_34.txt AC 25 ms 792 KB
01_rand_35.txt AC 27 ms 792 KB
01_rand_36.txt AC 26 ms 880 KB
01_rand_37.txt AC 25 ms 872 KB
01_rand_38.txt AC 26 ms 792 KB
01_rand_39.txt AC 26 ms 744 KB