prompt
string
response
string
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#!/usr/bin/env python from __future__ import division, print_function import os import sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def main(): allowed_digits = [0, 1, 2, 5, 8] rev...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import os import sys from math import * from collections import * # from fractions import * # from heapq import* from bisect import * from io import BytesIO, IOBase def vsInput(): sys.stdin = open("input.txt", "r") sys.stdout = open("output.txt", "w") BUFSIZE = 8192 class FastIO(IOBase): newlines = 0...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; public class Main { static int h; static int m; public static void main(String[] args) throws IOException { // br = new BufferedReader(new FileReader(new File("input.txt"))); // out = new PrintWriter(new File("cutting.out")); int jopa = nextInt()...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> #include <unordered_set> using namespace std; ///// Change default type here :D ///// typedef long long num; ////////////////////////////// void PrintBool(bool a); num a, b, c, d, e, f, g, h, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z; // Does not contain i and j string s1, s2, t1; vector...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
//Bismillahir Rahmanir Raheem #include<bits/stdc++.h> using namespace std; typedef pair<int,int>pii; #define sf(x) scanf("%d",&x) #define sfl(x) scanf("%lld",&x) #define lli long long int #define ll64 int64_t #define pb push_back #define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define frr(i...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class EdB { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc; public static PrintWriter out; public static void main(String[] omkar) throws Exception{ // TODO Auto-generated method stub sc = new MySc...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from collections import Counter, defaultdict, deque import bisect from sys import stdin, stdout from itertools import repeat import math def inp(force_list=False): re = map(int, raw_input().split()) if len(re) == 1 and not force_list: return re[0] return re def inst(): return raw_input().stri...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
# include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; int rc(char c) { switch(c) { case '0': return 0; case '1': return 1; case '2': return 5; case '5': return 2; case '8': return 8; } return -1; } int helper(int tm, int lmt, int x) { int d, result = ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
# Author : raj1307 - Raj Singh # Date : 06.03.2021 from __future__ import division, print_function import os,sys from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip def ii(): return int(input())...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.Scanner; public class solutioncode { public static void main(String[] args) { Scanner s = new Scanner(System.in); int testcases=s.nextInt(); while(testcases>0) { int h=s.nextInt(); int m=s.nextInt(); String ss=s.next(); int hh=(ss.charAt(0)-'0')*10 + ss.charAt(1)-'0'; ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import time,math as mt,bisect as bs,sys from sys import stdin,stdout from collections import deque from fractions import Fraction from collections import Counter from collections import OrderedDict from collections import defaultdict pi=3.14159265358979323846264338327950 def II(): # to take integer input return int...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
mir = [-1] * 10 mir[0] = 0 mir[1] = 1 mir[2] = 5 mir[5] = 2 mir[8] = 8 for i in range(int(input())): h, m = map(int, input().split()) hh, mm = map(int, input().split(':')) while True: hs = (hh // 10, hh % 10) ms = (mm // 10, mm % 10) m_ = (mir[hs[1]], mir[hs[0]]) h_ = (mir[ms...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
q = [-1 for i in range(10)] q[0] = 0 q[1] = 1 q[2] = 5 q[5] = 2 q[8] = 8 def get_reflected(h,m): nh = int(str(q[m%10]) + str(q[m/10])) nm = int(str(q[h%10]) + str(q[h/10])) return [nh,nm] def is_ref_exist(h,m): for i in str(h): if(q[int(i)]==-1): return False for i in str(m...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; import java.lang.*; public class ProblemD { static boolean arr[]={true, true,true,false,false,true,false,false,true,false}; static int image[]={0,1,5,-1,-1,2,-1,-1,8,-1}; static int h,m; public static void main(String[] args) { MyScanner scan = n...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long tt; cin >> tt; vector<long long> mmm(10); mmm[0] = 0; mmm[1] = 1; mmm[2] = 5; mmm[3] = -1; mmm[4] = -1; mmm[5] = 2; mmm[6] = -1; mmm[7] = -1; mmm[8] = 8; mmm[9] = -1; auto Chec...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <string> #include <map> #include <set> #include <stack> #include <tuple> #include <deque> #include <array> #include <numeric> #include <bitset> #include <iomanip> #include <cassert> #include <chrono> #include <random> ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; #define DIM 1000007 long long t, h, m, hh, mm, res, v; string s; bool cor(long long h1, long long m1){ swap(h1, m1); long long hh1, hh2, mm1, mm2; hh2 = h1/10; hh1 = h1%10; mm2 = m1/10; mm1 = m1%10; if(hh2==3 || hh2==4 || hh2==6 || hh2==7...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import sys import os.path from collections import * import math import bisect if(os.path.exists('input.txt')): sys.stdin = open("input.txt","r") sys.stdout = open("output.txt","w") else: input = sys.stdin.readline ############## Code starts here ########################## t = int(input()) nums = Counter(...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def func(s,n): l={1:1,2:5,5:2,0:0,8:8} s1=s%10 s2=s//10 if s1 in l: s1=l[s1] else: return 0 if s2 in l: s2=l[s2] else: return 0 rs=s1*10+s2 if rs<n: return 1 else: return 0 for _ in range(int(input())): n,k=map(int,inp...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def mirror(h, m): sh = list(str(h).zfill(2)) sm = list(str(m).zfill(2)) if set(['3', '4', '6', '7', '9']) & set(sh + sm): return False m = { '0': '0', '1': '1', '2': '5', '5': '2', '8': '8' } return (int(m[sm[1]] + m[sm[0]]), int(m[sh[1]] + m[sh[0]])) def tick(h, m, H, M): m += 1 if m == M: m =...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <algorithm> #include <iostream> #include <map> #include <set> #include <string> #include <vector> using namespace std; int H, M; bool mirror(int h, int m) { string sh = to_string(h); string sm = to_string(m); if (h < 10) sh = "0" + sh; if (m < 10) sm = "0" + sm; reverse(sh.begin(), sh.end()); rever...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define ii pair<int,int> #define vii vector<ii> #define si set<int> #define msi map<string,int> #define sp " " const int inf = 2e9; const int MX = 30; const int mod = 1e9+7; int arr[10]={0,1,5,-1,-1,2,-1,-1,8,-1}; int h,m; st...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> typedef long long ll; #define f(i,a,n) for(long long i=a;i<n;i++) using namespace std; int MM[10]={1,1,1,0,0,1,0,0,1,0}; bool mirror(string s) { for(int i=0;i<2;i++) { if(MM[s[i]-'0']==0) return false; } return true; } bool valid(string s,ll mirrorlimit,ll selflimit) { ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def check(time): arr = time[:] arr[0] = str(arr[0]) arr[1] = str(arr[1]) if len(arr[0]) == 1: arr[0] = '0' + arr[0] if len(arr[1]) == 1: arr[1] = '0' + arr[1] for x in arr: for y in x: if dic[y] == '-1': return 0 newarr = [dic[arr[1][1]] + dic[arr[1][0]], dic[arr[0][1]] + dic[arr[0][0]]] newarr[0...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
//Implemented By Aman Kotiyal Date:-06-Mar-2021 Time:-7:13:06 pm import java.io.*; import java.util.*; public class ques2 { public static void main(String[] args)throws Exception{ new ques2().run();} long mod=1000000000+7; int h; int m; void solve() throws Exception { for(int ii=ni();ii>0;ii--) { h=ni(...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from heapq import * from sys import * from math import * g=[0,1,5,-1,-1,2,-1,-1,8,-1] def up(s,n): if s[n]==0:s[n]=1 elif s[n]==1:s[n]=2 elif s[n]==2:s[n]=5 elif s[n]==5:s[n]=8 elif s[n]==8: if s[n-1]==0:s[n-1]=2 elif s[n-1]==2:s[n-1]=5 elif s[n-1]==5:s[n-1]=8 elif s[...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
t = int(input()) checklist = [0, 1, 2, 5, 8] for i in range(0, t): h, m = map(int, input().split()) time = str(input()) mirror = time[::-1] gggg = mirror.replace("2", "a") ggg = gggg.replace("5", "b") aaaa = ggg.replace("b", "2") finalmirror = aaaa.replace("a", "5") one = int(time[0]) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; import java.math.*; public class Main { static int func(int num,int m,HashMap<Integer,Integer> set ,int check) { while(true) { int a=num; int ones=a%10; a/=10; int tens=a%10; if(set.containsKey(ones) && set.containsKey(tens) && (set.get(ones)*10+set.get(ten...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
d={0:0,1:1,2:5,5:2,8:8} a={*d} R=lambda x:map(int,input().split(x)) t,=R(' ') while t: t-=1;h,m=R(' ');x,y=R(':') for i in range(h*m): r=x*m+y+i;p=f'{r//m%h:02}';s=f'{r%m:02}';b=u,v,w,q=*map(int,p+s), if{*b}<a and h>d[q]*10+d[w]and d[v]*10+d[u]<m: break print(p,s,sep=':')
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.Scanner; public class Main { static int ss[]={0,1,5,-1,-1,2,-1,-1,8,-1}; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int h=sc.nextInt(); int m=sc.nextInt(); String tim...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<iostream> #include<string> #include<algorithm> #include<cstdio> #include<cstring> #include<cmath> #include<map> #include <queue> #include<sstream> #include <stack> #include <set> #include <bitset> #include<vector> #define FAST ios::sync_with_stdio(false) #define abs(a) ((a)>=0?(a):-(a)) #define sz(x) ((int)(x)...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
class Time: def __init__(self, hh, mm) -> None: self.h = str(hh) self.m = str(mm) self.nh = int(hh) self.nm = int(mm) if len(self.h) < 2: self.h = '0'+self.h if len(self.m) < 2: self.m = '0'+self.m def rev(self): return Time(revers...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> #define ll long long using namespace std; int mirror[10] = {0, 1, 5, 9999, 9999, 2, 9999, 9999, 8, 9999}; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while(t--) { int h, m, h1, h2, m1, m2; string s; cin >> h >> m >...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from collections import Counter import math # class Solution(object): # def __init__(self): # self.d={} # def solve(self,vec,level): # #print "temp_vec:",vec," level=",level # if len(vec)==0: # return # if len(vec)==1: # self.d[vec[0]]=lev...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Practice { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int hrmax = s.nextInt(); int minmax ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #include<cmath> using namespace std; const int N = 55; int t; int h, m; char s[10]; int valid[110] = { 0,1,2,5,8,10,11,12,15,18,20,21,22,25,28,50,51,52,55,58,80,81,82,85,88,100};//25 int find(int x) { int l = 0, r = 25; while (l < r) { in...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
l=['0','1','2','5','8'] def g(x): if x=='2': return '5' if x=='5': return '2' return x def f(x,y,p,q): s1=str(x) s2=str(y) for c in s1: if c not in l: return False for c in s2: if c not in l: return False if len(s1)==1: s1='...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from os import path import sys,time # mod = int(1e9 + 7) from math import ceil, floor,gcd,log,log2 ,factorial,sqrt from collections import defaultdict ,Counter , OrderedDict , deque;from itertools import combinations,permutations # from string import ascii_lowercase ,ascii_uppercase from bisect import *;from functools ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> using namespace std; int c[12]; bool check(int h, int m, int hh, int mm){ int h2 = hh % 10; hh /= 10; int h1 = hh % 10; int m2 = mm % 10; mm /= 10; int m1 = mm % 10; if (c[h1] == -1 || c[h2] == -1 || c[m1] == -1 || c[m2] == -1) return false; int hh1 = h1, hh2 = h2; h1 = c[m2]; h2 = c...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class CodeForces1493B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); PrintWriter pw = new PrintWriter(System.out); while(t-->0) { int h = sc.nextInt(); int m = sc.nextInt(); String[] s = sc.next().spl...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define fastio \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) #define scl(n) scanf("%lld", &n) #define pcl(n) printf("%lld\n", n) #define pcl1(n) printf("%lld ", n) #define nln pr...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def changeNum(s,startDay, endDay,h,m): if (s == endDay): s = startDay return s list1 = list(s) x = int(s[2:4]) x += 1 nextHr = False if x == m: x = 0 nextHr = True if x < 10: list1[2] = '0' list1[3] = str(x) else: temp = str(x) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from __future__ import division import sys input = sys.stdin.readline import math from math import sqrt, floor, ceil from collections import Counter from copy import deepcopy as dc # from statistics import median, mean ############ ---- Input Functions ---- ############ def inp(): return(int(input())) def inlt()...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.Arrays; public class B_PlanetLapituletti { public static boolean check(int[] arr,int h,int m,int a,int b) { if(arr[a/10]==-1 || arr[a%10]==-1 || arr[b/10]==-1 || arr[b%10]==-1) { return false; } int hr=arr[b%10]*10+arr[b/10]; int min=arr[a%10]*10+arr[a/10]; if(...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import sys input = iter(sys.stdin.read().splitlines()).__next__ REFLECTIONS = [0, 1, 5, None, None, 2, None, None, 8, None] def reflect(hh, mm): # print(hh, mm) reflections = list(map(REFLECTIONS.__getitem__, [mm % 10, mm // 10, hh % 10, hh // 10])) if None in reflections: return None return...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <iostream> #include <string> #include <vector> using namespace std; int t; char num[5] = {'0', '1', '2', '5', '8'}; int h, m; string s; vector<string> times; string reverse(string str) { string res; for (int i = str.size() - 1; i >= 0; i--) { if(str[i] == '2') res += '5'; ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
# *****DO NOT COPY***** # F # U ___ ___ ___ ___ ___ ___ _____ # C / /\ ___ / /\ ___ /__/\ / /\ / /\ / /\ / /::\ # K / /::\ / /\ / /:/_ ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.lang.*; import java.io.*; public class Main { /* HashMap<> map=new HashMap<>(); TreeMap<> map=new TreeMap<>(); map.put(p,map.getOrDefault(p,0)+1); for(Map.Entry<> mx:map.entrySet()){ int v=mx.getValue(),k=mx.getKey(); }for (int i = 1; i <= 1000; i++) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> using namespace std; const int maxn=2e5+10; const int mod=998244353; #define ll long long #define ull unsigned long long #define pi pair<int,ll> #define fi first #define sc second #define pb push_back int h,m; int check(int x) { int hour=x/m; int minute=x-hour*m; hour%=h; minute...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from sys import stdin input = stdin.readline def reflect(n): a = n // 10 b = n % 10 s = 0 if b == 5: s += 20 elif b == 2: s += 50 else: s += b * 10 if a == 5: s += 2 elif a == 2: s += 5 else: s += a return s def next_reflectabl...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
""" ___. .__ .__ .__ __ __ _________ _____ \_ |__ | |__ |__| _____| |__ ____ | | _| | __ \______ \ \__ \ | __ \| | \| |/ ___/ | \_/ __ \| |/ / |/ / / / / __ \| \_\ \ Y \ |\___ \| Y \ ___/| <| < / / (____ /___ /___| /__/____ >_...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def refPos(twodigitstr): se = {'1':'1','0':'0','8':'8','2':'5','5':'2'} a, b = twodigitstr[0], twodigitstr[1] if a in se and b in se: return ''.join([se[b], se[a]]) return False for _ in range(int(input())): H, M = map(int, input().split()) s = input() ans = refPos(s[:2]) flag =...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; // 1:无需package // 2: 类名必须Main, 不可修改 public class Main { public static class node { public Integer a; public String name; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = Integer.valueOf(in.nextLine()); HashM...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.BufferedReader; import java.io.InputStreamReader; public class B { private static final boolean TEST_MODE = true; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int T = getInt(br); for (...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
//package codeforces; import java.util.Scanner; public class PlanetLapituletti { private static class Clock { int h, m; public Clock(int h, int m) { this.h = h; this.m = m; } } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); for(...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class Main{ static int[] codes= {0,1,5,-1,-1,2,-1,-1,8,-1}; public static boolean check(int nh,int nm,int h,int m) { if(codes[nh/10]==-1||codes[nh%10]==-1||codes[nm/10]==-1||codes[nm%10]==-1) { return false; } int mm=codes[nh%10]*10+codes[nh/10]; int hh=codes...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
// LAZY_LAD_69 using namespace std; #include<bits/stdc++.h> //DEFINE #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL); #define ll long long int #define nl "\n" #define forf(i,a,n) for(ll i=a;i<=n;i++) #define forb(i,b,n) for(ll i=b;i>=n;i--) #define pb pu...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.lang.*; import java.util.*; import java.io.*; public class Main { static FastScanner in = new FastScanner(); static int[] v = {0, 1, 5, -1, -1, 2, -1, -1, 8, -1}; static int compute(int x) { String s = String.valueOf(x); if (s.length() == 1) s = "0" + s; St...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#pragma GCC optimize("Ofast") #pragma GCC optimization("unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define ll long long int #define deb(x) cout << #x << " " << x << endl; #define mod 1000000007 #define mod2 998244353 #define fast std::ios::sync_with_stdio(false), cin...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; public class dung { static InputStream inputStream = System.in; static OutputStream outputStream = System.out; static InputReader in = new InputReader(inputStream); static PrintWriter out = new PrintWriter(outputStream); public static void main(String[] args) throws IOExcept...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def check(a,B): d = {0:0,1:1,2:5,5:2,8:8} temp2= 0 if a//10 in d and a%10 in d: temp2 = d[a//10] + d[a%10]*10 if temp2>=B: return 0 else: return 0 return 1 t = int(input()) for i in range(t): H,M = [int(i) for i in input().split()] h,m = [int(i) for i in i...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import io import os from collections import Counter, defaultdict, deque reflect = {0: 0, 1: 1, 2: 5, 5: 2, 8: 8} valid = {} for h1 in [0, 1, 2, 5, 8]: for h2 in [0, 1, 2, 5, 8]: h = h1 * 10 + h2 flip = reflect[h2] * 10 + reflect[h1] valid[h] = flip def makeClock(h, m): return str(...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; vector < int > go = {0, 1, 5, -1, -1, 2, -1, -1, 8, -1}; int inf = 1e9 + 7; int get(int x) { string s = to_string(x); if ((int)s.size() == 1) s = "0" + s; string answ = ""; for (int i = 1; i >= 0; --i) { if (go[s[i] - '0'] == -1) return inf; ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.Scanner; public class B { private static int[] invs = new int[]{0, 1, 5, -1, -1, 2, -1, -1, 8, -1}; public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for (int i = 0; i < t; i++) { int H = in.nextInt(); ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class codeforces { public static boolean valid(int h,int m,int h2,int m2) { int h3=0; int m3=0; int c=h2%10; h2/=10; if(c==0||c==1||c==8) { m3+=c; m3*=10; }else if(c==5) { m3+=2; m3*=10; }else if(c==2) { m3+=5; m3*=10; }else { return...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; import java.text.DecimalFormat; public class Main { static long mod=(long)1e9+7; static long mod1=998244353; public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define int long long int bool isvalid( int H, int M, int h, int m ) { string hour = to_string(M); string minu = to_string(H); reverse(hour.begin(), hour.end()); reverse(minu.begin(), minu.end()); if( hour.length() == 1 ) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
N=100 a=5,N,N,2,N,N,8,N,0,1 R=lambda x=' ':map(int,input().split(x)) t,=R() while t: t-=1;h,m=R();x,y=R(':');y+=x*m;u=v=w=q=N while h<=w+q*10or v*10+u>=m:r=f'{y//m%h:02}:{y%m:02}';y+=1;u,v,_,w,q=(a[ord(x)%10]for x in r) print(r)
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
reflected = { '0': '0', '1': '1', '2': '5', '3': '-', '4': '-', '5': '2', '6': '-', '7': '-', '8': '8', '9': '-', ':': ':' } def getReflectedTime(originTime): reflectedTime = ''.join(map(lambda digit: reflected[digit], originTime))[::-1] if '-' in reflectedTime: return None return reflectedTime de...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<string> #include<map> #include<queue> #include<vector> #include<iomanip> typedef long long ll; #define re register //#define inf INT32_MAX //_LINE_ _TIME_ _DATE_ using namespace std; const int M = 9e4 + 5; const int N =...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.lang.*; import java.io.*; public class B { BufferedReader input; BufferedWriter output; StringTokenizer st; private static float binarySearch(ArrayList<Long> arr, int start, int end, long x) { if (end >= start) { int mid = start + (end - start) / 2; ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class D { static int mod = (int) (1e9+7); static InputReader in; static PrintWriter out; static int[] converter = new int[]{0, 1, 5, -1, -1, 2, -1, -1, 8, -1}; static int convert(int time) { int digit1 = time%10; time /= 10; ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <iostream> #include <vector> #include <iterator> #include <unordered_map> #include <map> #include <algorithm> #include <utility> #include <string> #include <stack> #include <set> using namespace std; typedef long long ll; set<int> st, stc; bool checksym(int h1, int h2, int m1, int m2, int h, int m){ i...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import sys testing = len(sys.argv) == 4 and sys.argv[3] == "myTest" if testing: cmd = sys.stdout from time import time start_time = int(round(time() * 1000)) readAll = open(sys.argv[1], 'r').read sys.stdout = open(sys.argv[2], 'w') else: readAll = sys.stdin.read # ############ ---- I/O Functio...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
// God put a smile upon your face <3 #include <bits/stdc++.h> #define slld(longvalue) scanf("%lld", &longvalue) #define ll long long #define ull unsigned long long #define pll pair < long long, long long > #define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0) #define pb push_back #define bug ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int T = sc.nextInt(); PrintWriter pw = new PrintWriter(System.out); while(T-->0) { int h = sc.nextInt(); int m = sc.nextInt(); String[] s = sc.next().split(":"); int ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
"""from math import * from bisect import * from collections import * from random import * from decimal import *""" import sys input=sys.stdin.readline def inp(): return int(input()) def st(): return input().rstrip('\n') def lis(): return list(map(int,input().split())) def ma(): return map(int,input().sp...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; import java.math.*; /** * * @Har_Har_Mahadev */ public class B { private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353; private static int N = 0; private static HashMap<Integer, Integer> map; public static void process() throws IOException { ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
/* Powered by C++11. Author : Alex_Wei. */ #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize(3) //#define int long long using uint = unsigned int; using ll = long long; using ull = unsigned long long; using db = double; using ld = long double; using pii = pair <int,int>; using pll = pair <ll,ll>...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def r(str): s ="" for i in str: if(i=="2"): s = "5" + s elif(i=="5"): s= "2" +s else: s = i +s return s def solve(): l1=list(input().split()) h = l1[0] m = l1[1] l2=list(input().split(":")) h1 = l2[0] ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <map> #include <set> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <bitset> #include <cstdio> #include <string> #include <random> #include <vector> #include <climits> #include <cstring> #include <cstdio> #include <numeric> #include <iostream> #include <algorithm> #include <functi...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class PlanetLapituletti { public static Set<Integer> validDigits = new HashSet<>(Arrays.asList(0, 1, 2, 5...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> using namespace std; #define F first #define S second #define ll long long #define lld long double #define vc vector<ll> #define pb push_back #define all(a) a.begin(),a.end() const ll MOD=(1e9 +7); typedef pair<ll,ll>pairs; ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
c_digits = [0,1,5,-1,-1,2,-1,-1,8,-1] def normalise(string): #Converts string of general form to the required form HH:MM n = len(string) if n ==5: return string if n == 3: #string = H:M return "0"+string[0]+":"+"0"+string[2] if n == 4: if string[2] == ":": #string = HH:M ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
clock = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] mirror = [0, 1, 5, -1, -1, 2, -1, -1, 8, -1] def check(h1, h2, m1, m2, m, H, M): if m[h1] == -1 or m[h2] == -1 or m[m1] == -1 or m[m2] == -1: return False if m[m2] * 10 + m[m1] < H and m[h2] * 10 + m[h1] < M: return True return False q = int(input()...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; public class Main { static FastScanner sc = new FastScanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(); static HashSet<Character> set = new HashSet<>(); public static void main(String[] args) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; public class CF { static Set<Integer> good = new HashSet<>(); static Set<Integer> bad = new HashSet<>(); static Map<Integer, Integer> mirror = new HashMap<>(); private static void sport(int hours, int minutes, String s) { mirror.put(0, 0); mirror.put(1, 1); ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include <bits/stdc++.h> using namespace std; map<int, int> M = {{0, 0}, {1, 1}, {2, 5}, {3, -1}, {4, -1}, {5, 2}, {6, -1}, {7, -1}, {8, 8}, {9, -1...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from __future__ import division,print_function from heapq import* import sys le = sys.__stdin__.read().split("\n")[::-1] af=[] r=[0,1,5,100,100,2,100,100,8,100] def mirror(h1,m1,h,m): hm=10*r[m1%10]+r[m1//10] mm=10*r[h1%10]+r[h1//10] return hm<h and mm<m for zorg in range(int(le.pop())): h,m=list(map(in...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.util.*; import java.io.*; //import java.math.*; public class Task{ // ..............code begins here.............. static long mod=(long)1e9+7,inf=(long)1e15; static void solve() throws IOException { int[] x=int_arr(); int h=x[0],m=x[1]; String[] s=read().spli...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
correct = {0: 0, 1: 1, 2: 5, 5: 2, 8: 8} for i in range(int(input())): h, m = map(int, input().split()) oclock, minute = map(int, input().split(':')) while True: a, b = oclock // 10, oclock % 10 c, d = minute // 10, minute % 10 try: new_oclock = int(str(correct[d]) + str...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import sys import math import bisect from sys import stdin, stdout from math import gcd, floor, sqrt, log2, ceil from collections import defaultdict as dd from bisect import bisect_left as bl, bisect_right as br from bisect import insort from collections import Counter from collections import deque from heapq import he...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def isvalid(s1,s2): s1 = str(s1) s2 = str(s2) if len(s1)!=2: s1 = '0'+s1 if len(s2)!=2: s2 = '0'+s2 a = 0 for i in range(2): if s1[1-i] not in d.keys(): return 0 a = a*10 + d[s1[1-i]] b = 0 for i in range(2): if s2[1-i] not in d.keys()...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
revert = { '0': '0', '1': '1', '2': '5', '3': '_', '4': '_', '5': '2', '6': '_', '7': '_', '8': '8', '9': '_' } def rev(s): return revert[s[1]] + revert[s[0]] for _ in range(int(input())): H, M = tuple(map(int, input().split())) h, m = tuple(map(int, input().split...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
#include<bits/stdc++.h> using namespace std; #define ll long long #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int main() { IOS ll t; cin>>t; while(t--) { ll h,m; cin>>h>>m; string s; cin>>s; ll h1=(s[0]-'0')*10+(s[1]-'0'),m1=(s[3]-'0')*10+(s[4]-'0')...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
def isCorrect(_h, _m, h, m): shh, smm = str(_h), str(_m) if _h < 10: shh = '0' + shh if _m < 10: smm = '0' + smm s = f'{shh}:{smm}' if '3' in s or '4' in s or '6' in s or '7' in s or '9' in s: return False if _h >= h or _h < 0: return False if _m>=m or _m<0: ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
from __future__ import division, print_function from itertools import permutations import threading,bisect,math,heapq,sys from collections import deque # threading.stack_size(2**27) # sys.setrecursionlimit(10**4) from sys import stdin, stdout i_m=9223372036854775807 def cin(): return map(int,sin().split()) def...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; public class B { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import java.io.*; import java.util.*; public class tank { //static StringBuilder IO = new StringBuilder(); static final FastScanner fs = new FastScanner(); static boolean[] isval = {true, true, true, false, false, true, false, false, true, false}; public static void main(String[] args) ...
Problem: The time on the planet Lapituletti goes the same way it goes on Earth but a day lasts h hours and each hour lasts m minutes. The inhabitants of that planet use digital clocks similar to earth ones. Clocks display time in a format HH:MM (the number of hours in decimal is displayed first, then (after the colon) ...
import sys,os,io from sys import stdin from math import log, gcd, ceil from collections import defaultdict, deque, Counter from heapq import heappush, heappop from bisect import bisect_left , bisect_right import math alphabets = list('abcdefghijklmnopqrstuvwxyz') def isPrime(x): for i in range(2,x): if...