Submission #2049656


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

bool checkHM(ll H,ll M,ll S){
  ll fa=30*3600*H + 30*(M*60+S);
  ll fb=3600;

  ll sa=60*M*6 + 6*S;
  ll sb=60;

  return (fa*sb < sa*fb);
}

bool checkMS(int H,int M,int S){
  if ( M < S ) return true;
  return false;
}

int main(){
  int H,M,S;
  int A,B;
  cin>>H>>M>>S;
  H%=12;

  ll tmp=0;
  
  cin>>A>>B;
  /*
  while(B>=12){
    tmp+=12*60*60;
    B-=12;
    A-=12*60;
  }
  cout<<A<<' '<<B<<endl;
  */
  ll L=1e9;
  ll R=0;
  
  while(1){
    if(A<0 || B<0)break;

    //    cout<<A<<' '<<B<<' '<<H<<' '<<M<<' '<<S<<endl;
    if(A==0 && B==0){
      L=min(L,tmp);
      R=max(R,tmp);
    }

    
    int ts=S;
    int tm=M;
    int th=H;
    
    tmp++;
    S++;
    if(S==60){
      S=0;
      M++;
    }
    if(M==60){
      M=0;
      H++;
    }
    if(H==12){
      H=0;
    }

    if( !checkMS(th,tm,ts) )
      A-=checkMS(H,M,S);
    
    if( !checkHM(th,tm,ts) )
      B-=checkHM(H,M,S);

  }
  if(L<=R)cout<<L<<' '<<R<<endl;
  else cout<<-1<<endl;

  return 0;
}

Submission Info

Submission Time
Task A - アナログ時計
User dohatsutsu
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1127 Byte
Status WA
Exec Time 8 ms
Memory 764 KB

Judge Result

Set Name All
Score / Max Score 0 / 400
Status
AC × 35
WA × 1
Set Name Test Cases
All _sample_01, _sample_02, _sample_03, _sample_04, corner_01, corner_02, fixed-random-01, fixed-random-02, fixed-random-03, fixed-random-04, fixed-random-05, fixed-random-06, fixed-random-07, fixed-random-08, fixed-random-09, fixed-random-10, large-01, large-02, large-03, large-04, large-05, large-06, large-07, large-08, large-09, large-10, random-01, random-02, random-03, random-04, random-05, random-06, random-07, random-08, random-09, random-10
Case Name Status Exec Time Memory
_sample_01 AC 8 ms 764 KB
_sample_02 AC 1 ms 256 KB
_sample_03 AC 1 ms 256 KB
_sample_04 AC 4 ms 256 KB
corner_01 WA 5 ms 256 KB
corner_02 AC 1 ms 256 KB
fixed-random-01 AC 4 ms 256 KB
fixed-random-02 AC 1 ms 256 KB
fixed-random-03 AC 3 ms 256 KB
fixed-random-04 AC 2 ms 256 KB
fixed-random-05 AC 4 ms 256 KB
fixed-random-06 AC 4 ms 256 KB
fixed-random-07 AC 3 ms 256 KB
fixed-random-08 AC 4 ms 256 KB
fixed-random-09 AC 4 ms 256 KB
fixed-random-10 AC 4 ms 256 KB
large-01 AC 4 ms 256 KB
large-02 AC 4 ms 256 KB
large-03 AC 4 ms 256 KB
large-04 AC 5 ms 256 KB
large-05 AC 4 ms 256 KB
large-06 AC 4 ms 256 KB
large-07 AC 4 ms 256 KB
large-08 AC 4 ms 256 KB
large-09 AC 4 ms 256 KB
large-10 AC 5 ms 256 KB
random-01 AC 3 ms 256 KB
random-02 AC 3 ms 256 KB
random-03 AC 1 ms 256 KB
random-04 AC 4 ms 256 KB
random-05 AC 4 ms 256 KB
random-06 AC 2 ms 256 KB
random-07 AC 4 ms 256 KB
random-08 AC 1 ms 256 KB
random-09 AC 2 ms 256 KB
random-10 AC 2 ms 256 KB