Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*********... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.*;
import java.util.*;
public class P1493B2 {
static InputReader in = new InputReader(System.in);
static PrintWriter pw = new PrintWriter(System.out);
static long mod = (long) (Math.pow(10, 9)) + 7;
static HashMap<Integer, List<Integer>> adjList = new HashMap<>();
static boolean[] vis... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | t = int(input())
CAN_INVERSE = {
"1": "1",
"2": "5",
"5": "2",
"8": "8",
"0": "0"
}
def is_inversable(num: str):
num = list(num)
res = ""
for char in num[::-1]:
if char not in CAN_INVERSE:
return None
res += CAN_INVERSE[char]
return res
KEYS = ["0", "1"... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | t = int(input())
for _ in range(t):
hour, minute = map(int, input().split())
ta, tb = map(int, input().split(':'))
def clip(a, b):
b += 1
if b == minute:
a += 1
b = 0
if a == hour:
a = 0
return a, b
def clock(a, b):
a, b = str... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.io.*;
public class Equal {
static class pair implements Comparable<pair> {
int x;
int y;
public pair(int u, int v) {
this.x = u;
this.y = v;
}
@Overri... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | mp={1:1,2:5,5:2,8:8,0:0}
def getreflect(mh,lh,mm,lm,h,m):
boo=True
global mp
if lh not in mp.keys():
return False
if mh not in mp.keys():
return False
if lm not in mp.keys():
return False
if mm not in mp.keys():
return False
if mp[lh]*10+mp[mh]>=m or mp[lm]... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <unordered_map>
using namespace std;
int h, m;
unordered_map<int, int> mp;
bool is_valid(int hour, int minute)
{
int a, b, c, d;
unordered_map<int, int>::iterator it_a, it_b, it_c, it_d;
... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | R = dict()
R['0'] = '0'
R['1'] = '1'
R['2'] = '5'
R['5'] = '2'
R['8'] = '8'
for _ in range(int(input())):
H, M = map(int, input().split(' '))
h, m = map(int, input().split(':'))
def reflect(t):
h = str((t // M) % H).zfill(2)
m = str((t % M) % M).zfill(2)
try:
nh = ... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | def isSafe(s, h, m):
if int(s[:2]) >= h or int(s[3:]) >= m:return False
s = list(s[::-1])
for i in range(5):
if s[i] == '2':s[i] = '5'
elif s[i] == '5':s[i] = '2'
s = ''.join(s)
if int(s[:2]) >= h or int(s[3:]) >= m:return False
for d in ['3', '4', '6', '7', '9']:
if d in... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
int h,m;
int r[10]={0,1,5,-1,-1,2,-1,-1,8,-1};
bool check(int a,int b){
if(r[a%10]==-1 || r[a/10]==-1 || r[b%10]==-1 || r[b/10]==-1) return false;
return r[a%10]*10+r[a/10]<m && r[b%10]*10+r[b/10]<h;
}
void solve(){
int a... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | /*
AUTHOR: ADVAY AGGARWAL
INSTITUTION: IIIT DHARWAD
*/
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007 //1e9+7 ans%mod
#define ll long long int
#define test_cases(x) int x; cin>>x; while(x--)
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
#define endl "\n"
void starter... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import sys
import itertools
import collections
def rs(x=''):
if len(x) == 0:
return sys.stdin.readline().strip()
return input(x).strip()
def ri(x=''): return int(rs(x))
def rm(x=''): return map(str, rs(x).split())
def rl(x=''): return rs(x).split()
def rmi(x=''): return map(int, rl(x))
def rli(x=''): ... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.*;
import java.util.*;
import java.util.Collections;
public class div2_705_B implements Runnable
{
int t,h,m;
public void run()
{
InputReader sc = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-- > 0)
... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | class Clock:
def __init__(self, h, m, hh, mm):
self.h = h
self.m = m
self.hh = hh
self.mm = mm
def xx_str(self, xx):
return str(xx).zfill(2)
def __str__(self):
return self.xx_str(self.hh) + ':' + self.xx_str(self.mm)
def x_rev(self, x):
revs = {... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.math.*;
import java.io.*;
// Arrays.sort();
//char[] a=fs.next().toCharArray();
public class B_Planet_Lapituletti {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int T = fs.nextInt... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
/**
* @author Mubtasim Shahriar
*/
public class Cr705A {
public static void main(String[] args) {
InputStream inputStream = System.in;
... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
const int maxn = 1e7 + 10;
const int N = 3e4 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;;
int t;
int h,m;
char hh[3];
char mm[3];
int num[10];
char s[10];
bool check(int num)
{
if((num % 10 == 1 || num % 10 ==... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | nums = {'0': '0', '1': '1', '2': '5', '5': '2', '8': '8'}
def fmt_num(x):
return str(x).rjust(2, '0')
def is_valid(hh, mm, h, m):
hh = fmt_num(hh)
mm = fmt_num(mm)
if not all(c in nums for c in hh+mm): return False
hh, mm = int(nums[mm[1]]+nums[mm[0]]), int(nums[hh[1]]+nums[hh[0]])
return 0 <= ... | PYTHON |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B_Planet_Lapituletti {
int h,m;
void run(FastScanner sc){
h = sc.nextInt();
m = sc.nextInt();
String s = sc.nextLine();
// System.out.print... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | valid=[0,1,2,5,8]
valid1=[0,1,2,5,8,6]
def opos(x):
a=x%10
b=x//10
if a==2:
a=5
elif a==5:
a=2
if b==2:
b=5
elif b==5:
b=2
return (a)*10+(b)
def opos1(x):
a=x%10
b=x//10
if a==2:
a=5
elif a==5:
a=2
elif a==9:
a=6
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | rn=lambda:int(input())
rns=lambda:map(int,input().split())
rl=lambda:list(map(int,input().split()))
rs=lambda:input()
YN=lambda x:print('YES') if x else print('NO')
mod=10**9+7
from bisect import bisect_left
def isvalid(i,j,k,l,h,m):
ans=(10*int(i)+int(j))<h and (10*int(k)+int(l))<m
def reverse(char):
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | t = int(input())
for q in range(t):
h, m = map(int, input().split())
s = input()
s1 = s[0:2]
s2 = s[3:5]
while True:
s3 = ""
s4 = ""
b = True
for i in range(len(s1)-1, -1, -1):
if s1[i] == '0':
s4 += '0'
elif s1[i] == "1":
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.lang.*;
public class Planet_Lapituletti {
static int[] ref = {0,1,5,-1,-1,2,-1,-1,8,-1};
public static void main(String[] args) throws java.lang.Exception{
Scanner input = new Scanner(System.in);
int t = Integer.parseInt(input.nextLine());
for(int i=0;i<t... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | accepted_numbers = [1, 2, 5, 8, 0]
reverse_numbers = {1: 1, 2: 5, 5: 2, 8: 8, 0: 0}
# def time_accepted(hn, mn, h, m):
# h1 = hn // 10
# h0 = hn % 10
# m1 = mn // 10
# m0 = mn % 10
# if not (h1 in accepted_numbers and h0 in accepted_numbers and m0 in accepted_numbers and m1 in accepted_numbers):
#... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.Scanner;
public class PlanetLapituletti {
public static String mirror(String moment) {
char[] mirror = {'0', '1', '5', '/', '/', '2', '/', '/', '8', '/'};
String[] splitMoment = moment.split(":");
String hours = splitMoment[0];
String minutes = splitMoment[1];
... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl ("\n")
void solve()
{
ll h,m;
cin>>h>>m;
string s;
cin>>s;
ll H = (s[0]-'0')*10 + s[1]-'0';
ll M = (s[3]-'0')*10 + s[4]-'0';
ll a[] = {0,1,5,-1,-1,2,-1,-1,8,-1};
for(ll i=H;i<h;i++)
{
for(ll j=0;j... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 987654321
ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }
int h[3], m[3];
int H, M;
int chk[5] = { 3, 4, 6, 7, 9 };
bool Check(void)
{
bool hasAns = true;
for (i... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | I=lambda x:[*map(int,input().split(x))]
for _ in' '*I(' ')[0]:
hh,mm=I(' ')
h,m=I(':')
convert=[0,1,5,-1,-1,2,-1,-1,8,-1]
while 1:
ah=convert[h//10]
bh=convert[h%10]
am=convert[m//10]
bm=convert[m%10]
H=10*bm+am
M=10*bh+ah
if -1 in [ah,bh,am,bm] or... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | for _ in range(int(input())):
hh, mm = map(int, input().split())
timeTr = []
inp = input()
time = [int(inp[0] + inp[1]), int(inp[3] + inp[4])]
def tTr():
global time
global timeTr
t0 = time[0]
t1 = time[1]
timeTr = [time[0] // 10, time[0] % 10, time[1] // 10,... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | for i in range(int(input())):
a=[int(j) for j in input().split()]
h=a[0]
m=a[1]
s=input()
l1=['0','1','2','5','8']
l2=['0','1','5','2','8']
H=s[:2]
H0=H
M=s[3:]
while int(H)<h:
if len(str(int(H)))==1:
if H=='09':
H='10'
else:
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <ioma... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.lang.*;
public class Codeforces {
static Scanner sr = new Scanner(System.in);
static int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
static int w[]={0,1,5,-1,-1,2,-1,-1,8,-1};
static boolean check(int p1,int p2,int q1,... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | # region fastio
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.w... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | T=int(input())
def convert(s):
s=s[::-1]
s1=""
for z in s:
if(z=="2"):
s1=s1+"5"
elif(z=="5"):
s1=s1+"2"
else:
s1=s1+z
return int(s1)
for x in range(T):
a=[int(y) for y in input().split()]
h=a[0]
m=a[1]
s=input()
h1=s[0:2]
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | # 0 1 2 5 8
ref = {
'0': '0',
'1': '1',
'2': '5',
'5': '2',
'8': '8',
':': ':'
}
def reflect(time):
return ''.join([ref[time[i]] for i in range(len(time)-1, -1, -1) ])
def check(time):
if any(num not in ref for num in time):
return False
else:
return True
def ... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cp... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<iostream>
#include<cstdio>
using namespace std;
int T;
string s;
int h,m;
int x,y;
int fl[10]={0,1,5,-1,-1,2,-1,-1,8,-1};
void print(int x,int y)
{
cout<<x/10<<x%10<<":"<<y/10<<y%10<<endl;
}
void add(int &x,int &y)
{
y++;
if(y==m) y=0,x++;
if(x==h) x=0;
}
int op(int x,int y)
{
int a=x/10,... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | symmetric_digits = {
'0': '0',
'1': '1',
'2': '5',
'5': '2',
'8': '8',
}
def invert_digits(tt):
res = ''
for d in reversed(f'{tt:02d}'):
if d not in symmetric_digits: return float('inf')
res += symmetric_digits[d]
return int(res)
def valid(hh, mm, h, m): return invert_d... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | r = {'0': '0', '1': '1', '2': '5', '5': '2', '8': '8'}
d = {}
o = '01258'
for i in o:
for j in o:
for k in o:
for l in o:
d[int(i + j, 10), int(k + l, 10)] = (int(r[l] + r[k], 10), int(r[j] + r[i], 10))
def solve():
h, m = map(int, raw_input().split())
s = map(int, raw_in... | PYTHON |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.lang.*;
import java.io.*;
import java.awt.*;
// U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................
//JUst keep faith in ur strengths ..................................................
// ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 ... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
valid={0:0,1:1,2:5,5:2,8:8}
for _ in range(int(input())):
h,m=map(int,input().split())
hour,min=input().split(":")
while 1:
if int(min)>=m:
min="0"
hour=str(int(hour)+1)
if int(hour)>=h:hour="0"
min="0"*(len(min)==1)+min
hour = "0" * (len(hour) ==... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.Scanner;
public class TaskB {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int j = 0; j < t; j++) {
int h = in.nextInt();
int m = in.nextInt();
in.nextLine();
String ... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;
import ... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | a=int(input())
reflect=[0,1,5,-1,-1,2,-1,-1,8,-1]
for i in range(a):
h,m=map(int,input().split())
s=input()
l1=[h%10,h//10]
l2=[m%10,m//10]
x=s.index(':')
s1=int(s[0:2])
s2=int(s[3:])
glag=0
value=(s1*m)+(s2)
ori=h*m
cnt=0
while(glag==0):
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | d = {0:0,1:1,2:5,5:2,8:8}
def check(curr):
ones,tens = curr%10,curr//10
if ones in d and tens in d:
return d[ones]*10 + d[tens]
return 10**5
def solve():
for _ in range(int(input())):
h,m =[int(x) for x in input().split()]
x,y = map(int , input().split(":"))
while True:... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | t=int(input())
for z in range(t):
h,m=map(int,input().split())
s=input()
hrs=s[:2]
mi=s[3:]
while(1):
arr=[]
if int(mi)==m:
mi=0
if int(hrs)<h-1:
hrs=int(hrs)+1
else:
hrs=0
if len(str(hrs))==1:
hr... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | # DEFINING SOME GOOD STUFF
from math import *
import threading
import sys
from collections import defaultdict
from pprint import pprint
sys.setrecursionlimit(300000)
# threading.stack_size(10**8)
'''
-> if you are increasing recursionlimit then remember submitting using python3 rather pypy3
-> sometimes increasing stac... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class Q2 {
private interface Solution {
void run(int t);
}
private static final boolean IS_MULTITASK = true;
private static final boolean IS_ISOLATED = true;
private static final Scanne... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | // BABITHA'S CODE.//
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define int_max 9223372036854775807
#define float double
#define pii pair<int, int>
#define fl(i, a, b) for (int i = a; i < b; i++)
#define dy(a, n) int *a = new int[n]
#define mii map<int, int>
#define vec(a) vector<a>
#define M... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
#define ll long long int
#define VEC vector<ll>
#define PAIR pair<ll, ll>
#define VECP vector<PAIR>
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define rep(st, n) for (ll i = st; i < n; i++)
#define repr(st, n) for (ll... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
#include<bits/stdc++.h>
using namespace std;
#include<cstring>
#include<vector>
typedef long long int ll;
typedef long double ld;
typedef double db;
ll solve(ll i,ll h)
{
ll a[10]={0,1,5,-1,-1,2,-1,-1,8,-1};
ll b=i/10,c=i%10;
if( a[b]!=-1 && a[c]!=-1 )
{
ll ch= 10*( a[c] )+a[b];
... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
bool check(int a){
if(a==0 || a==1 || a==2 || a==5 || a==8) return true;
return false;
}
int mirror(int a){
if(a==0) return 0;
if(a==1) return 1;
if(a==2) return 5;
if(a==5) return 2;
if(a==8) return 8;
return 0;
}
int main(){
#ifndef ONLINE_... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
#define int long long
#define double long double
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second
using namespace std;
using pi = pair<int,int>;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int minf = 0xc0c0c0c0c0c0c0c0;
inlin... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
public class Main {
public static void main(String []args){
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
while(t-->0){
int h=scn.nextInt();
int m=scn.nextInt();
String str=scn.next();
int []arr={0,1,5,-1,-1,2,-1,... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.io.*;
public class cc_march2020_long {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
HashMap<Integer,Integer> reflect=new HashMap();
reflect.put(0,0);
reflect.put(1, 1);
reflect.put(2, 5);
reflect.put(5, 2);
reflect.... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int rev(int x){
vector<int> v;
for(int i=0;i<2;i++){
int d=x%10;
x/=10;
if(d!=0&&d!=1&&d!=2&&d!=5&&d!=8){
return -1;
}
if(d==2||d==5) d^=2^5;
v.push_back(d);
}
return v[0]*10+v... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | //package com.example.activitytest;
/*
Command + D 复制当前行到下一行
Command + Delete 删除当前行
Command + R 替换
Command + Option + L 格式化代码
Control + R 编译
*/
import java.util.*;
import java.io.InputStream;
import java.io.*;
import java.lang.*;
public class Main {
public static void main(String[] args) {
In... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();;
while (2*t-->0){
int h = sc.nextInt(); int m = sc.nextInt();
String s = sc.next();
String[] splitted = s.split(":"... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.io.*;
public class _705 {
static int hTotal; static int mTotal;
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t-- > 0)... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
#define LSOne(S) ((S) & -(S))
... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import sys
import re
import random
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
# sys.setrecursionlimit(1000000)
# input aliases
# input = sys.stdin.readline
getS = ... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | change = {0: 0, 1: 1, 2: 5, 5: 2, 8: 8}
bad = (3, 4, 6, 7, 9)
for _ in range(int(input())):
h, m = map(int, input().split())
s = input()
ch = int(s[:2])
cm = int(s[3:])
while True:
if not ((ch%10) in bad or (cm%10) in bad or (ch//10) in bad or (cm//10) in bad):
chm = change[ch%10... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | def incrementtime(h,m,s):
t=s.split(":")
ho=int(t[0])
mi=int(t[1])
if(mi+1<m):
mi+=1
return (t[0]+":"+(str(mi)).zfill(2))
elif (mi+1==m):
temp="00"
if(ho+1<h):
ho+=1
return((str(ho)).zfill(2)+":"+temp)
elif(ho+1==h):
return(... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef vector<vll> vvll;
typedef ... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | N=100
a=5,N,N,2,N,N,8,N,0,1
R=lambda x=' ':map(int,input().split(x))
t,=R()
exec(t*"h,m=R();x,y=R(':');y+=x*m;u=v=w=q=N\nwhile 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)\nprint(r)\n") | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
int t=Integer.parseInt(bu.readLine());
int r[]=n... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define ll long long
#define PI 3.1415926535897932384626
#define pb push_back
//#define mp make_pair
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
typedef pair<int, int> pi;
typedef pair<ll, l... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define fora(i,a,b) for(int i=a;i<=b;++i)
#define forb(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define all(a) a.begin(),a.end()
bool conv(int x)
{
if (x ... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | //Flower_On_Stone
#include <bits/stdc++.h>
using namespace std;
const int MIRROR[] = {0, 1, 5, -1, -1, 2, -1, -1, 8, -1};
int test, h, m;
string strClock;
int hour, minute;
int toInt(char ch) { return ch - '0'; }
string toString(int x)
{
string resuft = "";
for (int i = 1; i <= 2; i++)
{
resuft... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
int ara[] = {0, 1, 5, 0, 0, 2, 0, 0, 8};
bool valid(int n, int &x)
{
int a = n % 10;
n /= 10;
int b = n % 10;
if ((a == 0 || a == 1 || a == 2 || a == 5 || a == 8) && (b == 0 || b == 1 || b == 2 || b == 5 || b == 8)) {
x... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import math
import operator
def lcm(a,b):
return (a / math.gcd(a,b))* b
def nCr(n, r):
return((math.factorial(n))/((math.factorial(r))*(math.factorial(n - r))))
def isKthBitSet(n, k):
if (n & (1 << (k - 1))):
return True
else:
return False
def maximalRectangle( matrix):
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void test_case() {
int h, m;
cin >> h >> m;
int r[10] = { 0, 1, 5, -1, -1, 2, -1, -1, 8, -1};
string s, s1, s2;
cin >> s;
int x = (s[0] - '0') * 10 + s[1] - '0', y = (s[3] - '0') * 10 + s[4] - '0';
while... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.math.*;
public class SortTheArray
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int runs = sc.nextInt();
while(runs-->0)
{
int h = sc.nextInt();
int m = sc.nextInt();
String[] in = sc.next().split(":");
int hour = Integer.p... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | from sys import *; from math import *; from collections import *; from bisect import *; from itertools import *
INF = maxsize
def get_ints(): return map(int, stdin.readline().strip().split())
def get_array(): return list(map(int, stdin.readline().strip().split()))
def input(): return stdin.readline().strip()
mod = 1000... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.StringTokenizer;
public class B {
static BufferedReader br = new BufferedReader(new InputStreamRead... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
def reflective(newh, newm, th, tm):
r = '01258'
#print(int(str(newm).zfill(2)[::-1]), newm)
if not ((str(newh // 10) in r) and (str(newh % 10) in r)):
return False
if not ((str(newm // 10) in r) and (str(newm % 10) in r)):
return False
newm = str(newm).zfill(2)[::-1]
newh = str(newh).zfill(2)[::-1]
nm ... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #region Header
#!/usr/bin/env python3
# from typing import *
import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq
def input():
return sys.stdin.readline()[:-1]
# sys.setrecursionlimit(1000000)
#endregion
# _INPUT = """5
# 1 100
# 00:01
# 10 10
# 04:04
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | //Utilities
import java.io.*;
import java.util.*;
public class Main {
static int T;
static int h, m;
static int a, b;
static int[] v = new int[10];
static String[] tmp = new String[2];
public static void main(String[] args) throws IOException {
Arrays.fill(v, -1);
v[0] = 0; v[1] = 1; v[2] = 5; v[5] = 2; v[... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
string s;
char check[5]={'0','1','2','5','8'};
int h,m;
cin >> h >> m;
cin >> s;
int sum1 = 0,sum2=0;
int i;
for( i=0;i<s.size();i++)
{
if(s[i]==':')
break;
... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define M1 1000000007
#define M2 998244353
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define bfl(i,a,b) for(ll i=b-1;i>=a;i--)
#define f(i,n) for(int i=... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
def do():
conv = dict()
conv["0"] = "0"
conv["1"] = "1"
conv["2"] = "5"
conv["3"] = "xxxxxx"
conv["4"] = "xxxxxx"
conv["5"] = "2"
conv["6"] = "xxxxxx"
conv["7"] = "xxxxxx"
conv["8"] = "8"
conv["9"] = "xxxxxx"
def isitok(curtime):
curtime %= maxtime
h, m... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B> string to_string(pair<A, B> p);
string to_string(const char& ch) { return "'" + string(1, ch) + "'"; }
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include<cstdio>
using namespace std;
int tim[26]={0,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};
int flc[26]={0,0,10,50,20,80,1,11,51,21,81,5,15,55,25,85,2,12,52,22,82,8,18,58,28,88};
int amax,bmax;
int finda(int v)
{
while(1)
{
if(tim[v]>=amax) v=1;
if(flc[v]<bmax) return v;
v=v%25+... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vl;
#define pll pair<ll, ll>
#define vpl vector<pll>
#define vb vector<bool>
#define PB push_back
#define MP make_pair
#define ln "\n"
#define forn(i,e) for(ll i=0; i<e; i++)
#define forsn(i,s,e) for(ll i=s; i<e; i++)
#define ... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.*;
import java.util.*;
import java.lang.*;
public class beng{
public static int f(int x)
{
if(x == 5)return 2;
else if(x == 2)return 5;
else return x;
}
public static int chk(int x, int y, int A, int B)
{
int arr[] = {0, 1, 2, -1, -1, 5, -1, -1, 8, -1... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
int h, m, h1, h0, m1, m0, hh, mm;
int a[10] = {0, 1, 5, -1, -1, 2, -1, -1, 8, -1};
bool Chk(int x1, int x0, int y1, int y0) {
if(y1 == -1 || y0 == -1) return false;
if(y1 > x1) return false;
if(y1 == x1) return y0 < x0;
return true;
}
bool Check() {
int hh1 = hh / 10,... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int test=sc.nextInt();
for(int i=0;i<test;i++)
{
int h=sc.nextInt();
int m=sc.nextInt();
String str=sc.next();
boo... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | def mirro(n):
if n==5:
return 2
elif n==2:
return 5
else:
return n
t=int(input())
ok=[0,1,2,5,8]
for _ in range(t):
h,m=map(int,input().split())
ttime=str(input())
hnow,mnow=int(ttime[0])*10+int(ttime[1]),int(ttime[3])*10+int(ttime[4])
while True:
h0,h1=hnow/... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import ja... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class B {
static class Pair {
long a;
long b;
public Pair(long a, long b) {
this.a = a;
this.b = b;
}
}
public static void main(String[] args) throws Exception {
// wr... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pii pair<int,int>
#define pf push_front
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define ppb pop_bac... | CPP |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class _705_B {
static int t;
static int h, m;
static int hh, mm;
static long ans;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | nums = {'0': '0', '1': '1', '2': '5', '5': '2', '8': '8'}
def fmt_num(x):
return str(x).rjust(2, '0')
def is_valid(hh, mm, h, m):
hh = fmt_num(hh)
mm = fmt_num(mm)
md = ''
for d in (hh + mm)[::-1]:
if d not in nums: return False
md += nums[d]
return 0 <= int(md[:2]) < h and 0 <=... | PYTHON |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0)
{
int h = sc.nextInt(), m = sc.nextInt();
... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
public class B {
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int t = scan.nextInt();
while(t != 0) {
int mh = scan.nextInt();
int mm = scan.nextInt();
String[] arr = scan.next().split(":");
... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | a = [0, 1, 5, -1, -1, 2, -1, -1, 8, -1]
test = int(input())
def check(x, y, h, m):
if a[x // 10] == -1 or a[x % 10] == -1 or a[y // 10] == -1 or a[y % 10] == -1 :
return 0
if a[x % 10] * 10 + a[x // 10] >= m or a[y % 10] * 10 + a[y // 10] >= h :
return 0
return 1
def pnt(x, y):
res=''
... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | #------------------Important Modules------------------#
from sys import stdin,stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
input=stdin.readline
#prin=stdout.write
from random import sample
t=int(input())
#t=1
from collections import Counter,deque
from math impo... | PYTHON3 |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
import java.io.*;
public class B{
static class fastReader{
BufferedReader br;
StringTokenizer st;
public fastReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
String Next(){
while(st == null || !st.hasMoreE... | JAVA |
1493_B. Planet Lapituletti | 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) follows t... | 2 | 8 | import java.util.*;
public class cp{
static int h=0,m=0,hh=0,mm=0;
static boolean check(int nh,int nm,int[] pre)
{
if(pre[nh/10]==-1 || pre[nh%10]==-1 || pre[nm/10]==-1 || pre[nm%10]==-1)
return false;
int ih = pre[nm%10]*10+pre[nm/10];
int im = pre[nh%10]*10+pre[nh/10];
... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.