题意:时钟坏了,给你一段连续的时间,问你现在可能的时间是多少。
思路:直接模拟,他妈的居然这场就跪在了这题,卧槽,他妈的就在111行,居然多打了个 = ,这是什么意思,注孤生吗
#pragma comment(linker, "/STACK:1000000000")
#include <bits/stdc++.h>
#define LL long long
#define INF 0x3f3f3f3f
#define IN freopen("d.in","r",stdin);
#define OUT freopen("out.txt","w",stdout);
using namespace std;
#define MAXN 9999
int w[][], y[][];
bool first;
struct Node{
bool vis[];
Node(int x){
memset(vis, , sizeof(vis));
if(x != && x != ){
vis[] = true;
}
if(x != && x != && x != && x != ){
vis[] = true;
}
if(x != && x != ){
vis[] = true;
}
if(x != && x != && x != ){
vis[] = true;
}
if(x == || x == || x == || x == ){
vis[] = true;
}
if(x != ){
vis[] = true;
}
if(x != && x != && x != ){
vis[] = true;
}
}
}; struct Moment{
int hour, mi;
int u[];
Moment(int i = ){
hour = i / ;
mi = i % ;
u[] = hour / ;
u[] = hour % ;
u[] = mi / ;
u[] = mi % ;
}
void print(){
if(first){
printf("%d%d:%d%d", u[], u[], u[], u[]);
first = false;
}
else{
printf(" %d%d:%d%d", u[], u[], u[], u[]);
}
}
};
bool work(char *s, int x){
Moment t = Moment(x);
memset(w, , sizeof(w));
for(int i = ; i < ; i++){
if(i == ) continue;
Node p = Node(s[i] - '');
Node q = Node(t.u[i]);
for(int j = ; j <= ; j++){
if(!p.vis[j] && q.vis[j]){
w[i][j] = ;
continue;
}
if(p.vis[j] && !q.vis[j]){
return false;
}
if(p.vis[j] && q.vis[j]){
w[i][j] = ;
}
}
}
return true;
} bool work_y(char *s, int x){
Moment t = Moment(x);
memset(y, , sizeof(y));
for(int i = ; i < ; i++){
if(i == ) continue;
Node p = Node(s[i] - '');
Node q = Node(t.u[i]);
for(int j = ; j <= ; j++){
if(!p.vis[j] && q.vis[j]){
y[i][j] = ;
continue;
}
if(p.vis[j] && !q.vis[j]){
return false;
}
if(p.vis[j] && q.vis[j]){
y[i][j] = ;
}
}
}
return true;
}
bool check(){
for(int i = ; i < ; i++){
if(i == ) continue;
for(int j = ; j <= ; j++){
if(y[i][j] == ) continue;
if(w[i][j] == && y[i][j] != ){
w[i][j] = y[i][j];
continue;
}
if(w[i][j] == && y[i][j] == ){
return false;
}
if(w[i][j] == && y[i][j] == ){
return false;
}
}
}
return true;
}
char s[][];
int main()
{
//IN;
//OUT;
int n;
int cas = ;
while(~scanf("%d", &n)){
if(cas == ){
int o = ;
o = + ;
}
cas++;
for(int i = ; i <= n; i++){
scanf("%s", s[i]);
}
Moment t;
first = true;
for(int i = ; i < ; i++){
if( i == ){
int o;
o = + ;
}
if(!work(s[], i)) continue;
bool flag = false;
for(int j = ; j <= n; j++){
if(i + j - == ){
int o;
o = + ;
}
if(!work_y(s[j], (i + j - ) % )){
flag = true;
break;
}
if(check()) continue;
flag = true;
break;
}
if(flag) continue;
t = Moment(i);
t.print();
}
if(first){
printf("none\n");
}
else{
printf("\n");
}
}
return ;
}