QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#753028#3567. Digital Clockgyydp123_LIM100 ✓4ms3872kbC++201.5kb2024-11-16 11:00:462024-11-16 11:00:46

Judging History

This is the latest submission verdict.

  • [2024-11-16 11:00:46]
  • Judged
  • Verdict: 100
  • Time: 4ms
  • Memory: 3872kb
  • [2024-11-16 11:00:46]
  • Submitted

answer

//Start: 2024-11-16 10:52:34
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=(j);i<=(k);++i)
#define ForDown(i,j,k) for(int i=(j);i>=(k);--i)
#define Debug(fmt, args...) fprintf(stderr,"(func %s, line #%d): " fmt, __func__, __LINE__, ##args),fflush(stderr)
#define debug(fmt, args...) fprintf(stderr,fmt,##args),fflush(stderr)
#define within :
#define LJY main
using namespace std;
typedef long long ll;
const int N=1e5+5;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
int id[]={0b1011111,0b0000101,0b1110110,0b1110101,0b0101101,0b1111001,0b1111011,0b1000101,0b1111111,0b1111101};
int n,p[N];char s[10];
void ljy(){
  For(i,1,n){
    scanf("%s",s+1);
    p[i]=(id[s[1]-'0']<<21)|(id[s[2]-'0']<<14)|(id[s[4]-'0']<<7)|(id[s[5]-'0']);
  }
  vector<pair<int,int>>ans;
  For(i,0,23) For(j,0,59){
    int x=i,y=j;bool flg=1;int blc=0;
    For(k,1,n){
      int op=(id[x/10]<<21)|(id[x%10]<<14)|(id[y/10]<<7)|(id[y%10]);
      if((op&p[k])!=p[k]){flg=0;break;}
      blc|=(op^p[k]);
      y++;if(y==60) y=0,x++;if(x==24) x=0;
    }if(!flg) continue;x=i;y=j;
    For(k,1,n){
      int op=(id[x/10]<<21)|(id[x%10]<<14)|(id[y/10]<<7)|(id[y%10]);
      if((op&(~blc))!=p[k]){flg=0;break;}
      y++;if(y==60) y=0,x++;if(x==24) x=0;
    }if(flg) ans.emplace_back(i,j);
  }if(ans.empty()) puts("none");
  else{for(auto [x,y] within ans) printf("%d%d:%d%d ",x/10,x%10,y/10,y%10);puts("");}
}
signed LJY(){while(scanf("%d",&n)==1) ljy();}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 100
Accepted
time: 4ms
memory: 3872kb

input:

1 88:88
2 23:25 23:26
3 71:57 71:57 71:07
1 00:00
1 11:11
1 22:22
1 33:33
1 44:44
1 55:55
1 66:66
1 77:77
1 88:88
1 99:99
1 08:28
1 78:48
1 24:11
1 31:11
1 11:60
5 23:11 23:11 23:11 23:11 23:11
6 23:11 23:11 23:11 23:11 23:11 23:11
6 23:11 23:11 23:11 23:11 23:11 23:12
2 08:19 08:20
2 27:77 27:17
2 ...

output:

none
23:25 
00:58 03:58 07:58 08:58 
00:00 00:08 08:00 08:08 
00:00 00:01 00:03 00:04 00:07 00:08 00:09 00:10 00:11 00:13 00:14 00:17 00:18 00:19 00:30 00:31 00:33 00:34 00:37 00:38 00:39 00:40 00:41 00:43 00:44 00:47 00:48 00:49 01:00 01:01 01:03 01:04 01:07 01:08 01:09 01:10 01:11 01:13 01:14 01:1...

result:

ok 390 lines