QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#167250#7176. I Flipped The Calendar...ucup-team1134#AC ✓1ms3852kbC++172.8kb2023-09-07 13:12:132023-09-07 13:12:15

Judging History

你现在查看的是最新测评结果

  • [2023-09-07 13:12:15]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3852kb
  • [2023-09-07 13:12:13]
  • 提交

answer

// https://codeforces.com/contest/698/submission/152735692

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=105,INF=1<<30;

vector<int> monlen={31,28,31,30,31,30,31,31,30,31,30,31};

ll f(ll y,ll tuki,ll dd,ll youbi,ll hh,ll mm,ll ss){
    ll res=0;
    for(ll i=1970;i<y;i++){
        if((i%400==0)||(i%100!=0&&i%4==0)){
            res+=366*24*60*60;
        }else{
            res+=365*24*60*60;
        }
    }
    
    for(int i=0;i<tuki;i++){
        ll z=monlen[i];
        if((y%400==0)||(y%100!=0&&y%4==0)){
            if(i==1) z++;
        }
        res+=z*24*60*60;
    }
    
    res+=dd*24*60*60;
    
    res+=hh*60*60;
    
    res+=mm*60;
    
    res+=ss;
    
    return res;
}

void upd(ll &y,ll &tuki,ll &dd,ll &youbi,ll &hh,ll &mm,ll &ss){
    mm+=ss/60;
    ss%=60;
    hh+=mm/60;
    mm%=60;
    ll x=hh/24;
    youbi=(youbi+x)%7;
    dd+=x;
    hh%=24;
    for(ll i=tuki;;i++){
        ll z=monlen[i%12];
        if((y%400==0)||(y%100!=0&&y%4==0)){
            if(i%12==1) z++;
        }
        if(dd>=z){
            dd-=z;
            tuki++;
            if(tuki==12){
                y++;
                tuki=0;
            }
        }else{
            break;
        }
    }
}

ll s,m,h,day,date,month;

bool check(ll &y,ll &tuki,ll &dd,ll &youbi,ll &hh,ll &mm,ll &ss){
    upd(y,tuki,dd,youbi,hh,mm,ss);
    
    if(month!=-1){
        if(month!=tuki) return false;
    }
    if(h!=-1){
        if(hh!=h) return false;
    }
    if(m!=-1){
        if(mm!=m) return false;
    }
    if(s!=-1){
        if(ss!=s) return false;
    }
    if(date==-1&&day==-1){
        
    }else if(date==-1){
        if(day!=youbi) return false;
    }else if(day==-1){
        if(date!=dd) return false;
    }else{
        if((date!=dd)&&(day!=youbi)) return false;
    }
    
    return true;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll y=1969,tuki=0,dd=0,youbi=2,hh=0,mm=0,ss=0;
    ll Y;cin>>Y;
    ll ans=0;
    vector<int> S(12,-1);
    while(y<=Y){
        if(y==Y){
            if(S[tuki]==-1){
                ans++;
                S[tuki]=0;
            }else{
                if(youbi==0) ans++;
            }
        }
        ss+=86400;
        upd(y,tuki,dd,youbi,hh,mm,ss);
    }
    
    cout<<ans<<endl;
    
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

2023

output:

63

result:

ok 1 number(s): "63"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1970

output:

63

result:

ok 1 number(s): "63"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1971

output:

61

result:

ok 1 number(s): "61"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1972

output:

63

result:

ok 1 number(s): "63"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

1973

output:

63

result:

ok 1 number(s): "63"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

1974

output:

62

result:

ok 1 number(s): "62"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

1975

output:

62

result:

ok 1 number(s): "62"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

1976

output:

62

result:

ok 1 number(s): "62"

Test #9:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

1977

output:

63

result:

ok 1 number(s): "63"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

1978

output:

63

result:

ok 1 number(s): "63"

Test #11:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

1979

output:

63

result:

ok 1 number(s): "63"

Test #12:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

1980

output:

62

result:

ok 1 number(s): "62"

Test #13:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1981

output:

63

result:

ok 1 number(s): "63"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

1982

output:

61

result:

ok 1 number(s): "61"

Test #15:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1983

output:

63

result:

ok 1 number(s): "63"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3504kb

input:

1984

output:

64

result:

ok 1 number(s): "64"

Test #17:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

1985

output:

62

result:

ok 1 number(s): "62"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

1986

output:

62

result:

ok 1 number(s): "62"

Test #19:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

1987

output:

63

result:

ok 1 number(s): "63"

Test #20:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

1988

output:

62

result:

ok 1 number(s): "62"

Test #21:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

1989

output:

63

result:

ok 1 number(s): "63"

Test #22:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

1990

output:

63

result:

ok 1 number(s): "63"

Test #23:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

1991

output:

62

result:

ok 1 number(s): "62"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1992

output:

63

result:

ok 1 number(s): "63"

Test #25:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1993

output:

61

result:

ok 1 number(s): "61"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

1994

output:

63

result:

ok 1 number(s): "63"

Test #27:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

1995

output:

63

result:

ok 1 number(s): "63"

Test #28:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

1996

output:

62

result:

ok 1 number(s): "62"

Test #29:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1997

output:

62

result:

ok 1 number(s): "62"

Test #30:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1998

output:

63

result:

ok 1 number(s): "63"

Test #31:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

1999

output:

61

result:

ok 1 number(s): "61"

Test #32:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

2000

output:

63

result:

ok 1 number(s): "63"

Test #33:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

2001

output:

63

result:

ok 1 number(s): "63"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2002

output:

62

result:

ok 1 number(s): "62"

Test #35:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

2003

output:

62

result:

ok 1 number(s): "62"

Test #36:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

2004

output:

62

result:

ok 1 number(s): "62"

Test #37:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2005

output:

63

result:

ok 1 number(s): "63"

Test #38:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

2006

output:

63

result:

ok 1 number(s): "63"

Test #39:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

2007

output:

63

result:

ok 1 number(s): "63"

Test #40:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

2008

output:

62

result:

ok 1 number(s): "62"

Test #41:

score: 0
Accepted
time: 1ms
memory: 3844kb

input:

2009

output:

63

result:

ok 1 number(s): "63"

Test #42:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

2010

output:

61

result:

ok 1 number(s): "61"

Test #43:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

2011

output:

63

result:

ok 1 number(s): "63"

Test #44:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

2012

output:

64

result:

ok 1 number(s): "64"

Test #45:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

2013

output:

62

result:

ok 1 number(s): "62"

Test #46:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2014

output:

62

result:

ok 1 number(s): "62"

Test #47:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

2015

output:

63

result:

ok 1 number(s): "63"

Test #48:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

2016

output:

62

result:

ok 1 number(s): "62"

Test #49:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

2017

output:

63

result:

ok 1 number(s): "63"

Test #50:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

2018

output:

63

result:

ok 1 number(s): "63"

Test #51:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

2019

output:

62

result:

ok 1 number(s): "62"

Test #52:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

2020

output:

63

result:

ok 1 number(s): "63"

Test #53:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

2021

output:

61

result:

ok 1 number(s): "61"

Test #54:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2022

output:

63

result:

ok 1 number(s): "63"

Test #55:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

2024

output:

62

result:

ok 1 number(s): "62"

Test #56:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2025

output:

62

result:

ok 1 number(s): "62"

Test #57:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

2026

output:

63

result:

ok 1 number(s): "63"

Test #58:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

2027

output:

61

result:

ok 1 number(s): "61"

Test #59:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2028

output:

63

result:

ok 1 number(s): "63"

Test #60:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

2029

output:

63

result:

ok 1 number(s): "63"

Test #61:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

2030

output:

62

result:

ok 1 number(s): "62"

Test #62:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

2031

output:

62

result:

ok 1 number(s): "62"

Test #63:

score: 0
Accepted
time: 1ms
memory: 3560kb

input:

2032

output:

62

result:

ok 1 number(s): "62"

Test #64:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

2033

output:

63

result:

ok 1 number(s): "63"

Test #65:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

2034

output:

63

result:

ok 1 number(s): "63"

Test #66:

score: 0
Accepted
time: 1ms
memory: 3784kb

input:

2035

output:

63

result:

ok 1 number(s): "63"

Test #67:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

2036

output:

62

result:

ok 1 number(s): "62"

Test #68:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

2037

output:

63

result:

ok 1 number(s): "63"

Extra Test:

score: 0
Extra Test Passed