solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
n = int(input())
arr = list(map(int, input().split()))
prev = 0
interesting = 0
isBreak = False
for i in range(n):
boring = arr[i] - prev
if boring <= 15:
interesting += boring
else:
interesting += 15
isBreak = True
break
prev = arr[i]
if not isBreak and arr[-1] < 90:
boring = 90 - arr[i]
if boring <= 15:
interesting += boring
else:
interesting += 15
print(interesting) | 7 | PYTHON3 |
n = int(input())
minutes = list(map(int, input().split()))
last_interest = 0
for i in range(n):
if last_interest + 15 < minutes[i]:
print(last_interest + 15)
exit()
else:
last_interest = minutes[i]
print(min(last_interest + 15, 90))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, a[110];
int main() {
while (~scanf("%d", &n)) {
a[0] = 0;
a[n + 1] = 90;
for (int i = 1; i <= n + 1; i++) scanf("%d", a + i);
bool flag = true;
for (int i = 1; i <= n + 1 && flag; i++)
if (a[i] - a[i - 1] > 15) {
printf("%d\n", a[i - 1] + 15);
flag = false;
}
if (flag) printf("%d\n", 90);
}
return 0;
}
| 7 | CPP |
import sys
import math
import bisect
import itertools
import random
def main():
A = [0] * 91
n = int(input())
for a in list(map(int, input().split())):
A[a] = 1
cnt = 0
ans = 90
for i in range(1, 91):
if A[i] == 0:
cnt += 1
else:
cnt = 0
if cnt == 15:
ans = i
break
print(ans)
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n;
int t[100];
void read() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &t[i]);
}
void solve() {
t[n + 1] = 91;
for (int i = 0; i <= n; i++) {
if (t[i] + 15 < t[i + 1]) {
printf("%d\n", t[i] + 15);
return;
}
}
printf("%d\n", 90);
}
int main() {
read();
solve();
return 0;
}
| 7 | CPP |
n=int(input())
a=list(map(int, input().split()))
a.insert(0,0)
a.insert(len(a),90)
ans=0
for i in range (1,len(a),1):
t=a[i]-a[i-1]
if t<=15:
ans+=t
else:
ans+=15
break
print(ans) | 7 | PYTHON3 |
# import sys
# sys.stdin=open("input.in",'r')
# sys.stdout=open("out.out",'w')
n=int(input())
t=list(map(int,input().split()))
x=90
for i in range(n):
if i==0:
if t[i]-1>=15:
print(15)
exit()
elif t[i]-t[i-1]>15:
print(t[i-1]+15)
exit()
print(min(90,t[-1]+15))
| 7 | PYTHON3 |
n = int(input())
t = list(map(int, input().split()))
counter = 0
for i in range(n):
if t[i] - counter > 15:
break
counter = t[i]
print(min(90, counter + 15))
# ♥ | 7 | PYTHON3 |
#n=int(input())
#n,k=map(int,input().split())
#arr=list(map(int,input().split()))
n=int(input())
arr=list(map(int,input().split()))
for i in range(n-1):
if i==0:
if arr[i]>15:
print(15)
exit()
elif arr[i+1]-arr[i]>15:
print(arr[i]+15)
exit()
else:
if arr[i+1]-arr[i]>15:
print(arr[i]+15)
exit()
if n==1:
print(arr[0]+15 if arr[0]<=15 else 15)
exit()
elif n>1:
print(min(arr[-1]+15,90))
| 7 | PYTHON3 |
n = int(input())
l = list(map(int, input().split()))
if n == 1:
if l[0] <= 15:
print(l[0] + 15)
else:
print(15)
exit()
if l[0] > 15:
print(15)
exit()
for i in range(n - 1):
if l[i + 1] - l[i] > 15:
h = (l[i] + 15)
if h > 90:
print(90)
exit()
else:
print(h)
exit()
if l[n - 1] < 75:
print(l[n - 1] + 15)
else:
print(90) | 7 | PYTHON3 |
n = int ( input ())
l = list ( map ( int , input (). split ()))
c = 0
if ( l [ 0 ]> 15 ):
print ( 15 )
elif(n==1):
print(l[0]+15)
else :
for i in range ( 1 , n ):
if ( l [ i ] - l [ i - 1 ]> 15 ):
print ( l [ i - 1 ] + 15 )
c=1
break
else :
continue
if ( c==0 and l[-1]+15<=90):
print (l[-1]+15)
elif(c==0):
print(90) | 7 | PYTHON3 |
n = input()
f = list(map(int, input().split()))
watched = -1
for i in range(0, len(f)):
if i == 0:
if f[i] > 15:
watched = 15
break
else:
if f[i] - f[i - 1] > 15:
watched = f[i - 1] + 15
break
if watched == -1 and len(f) == 1:
watched = f[0] + 15
if watched == -1:
if f[-1] + 15 >= 90:
watched = 90
else:
watched = f[-1] + 15
print(watched)
| 7 | PYTHON3 |
n = int(input())
ans = 0
l = list(map(int , input().split()))
j = 0
for i in range(n):
if l[i]-j >15:
print(j+15)
ans = 1
break
j = l[i]
if ans == 0:
if j+15 >90 :
print(90)
else:
print(j+15)
| 7 | PYTHON3 |
if __name__ == '__main__':
n = int(input())
t = list(map(int,input().split()))
t= [0]+t+[90]
for i in range(len(t)-1):
if t[i+1] - t[i] - 1 >= 15:
print(t[i]+15)
exit()
print(90)
| 7 | PYTHON3 |
n = int(input())
lst = list(map(int, input().split()))
lst.insert(0, 0)
lst.append(90)
for i in range(n+1):
if lst[i+1]-lst[i]>15:
print(lst[i]+15)
break
else:
print(90)
| 7 | PYTHON3 |
def solve(n, t):
i = 0
s = 0
t.insert(0, 0)
t.append(91)
while i < n + 1:
if i + 1 < n+2:
d = t[i + 1] - t[i] - 1
if d > 14:
s += 15
return s
else:
s = min(90, t[i+1])
i += 1
return s
def main():
n = int(input())
t = list(map(int, input().split()))
print(solve(n, t))
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
int t[n];
for (i = 0; i < n; i++) cin >> t[i];
int ans = 90;
if (t[0] > 15) {
cout << 15 << endl;
return 0;
}
for (i = 0; i < n - 1; i++) {
if (t[i + 1] - t[i] > 15) {
ans = t[i] + 15;
cout << ans << endl;
return 0;
}
}
if (90 - t[n - 1] > 15) {
ans = t[n - 1] + 15;
cout << ans << endl;
return 0;
}
cout << ans << endl;
return 0;
}
| 7 | CPP |
n = input()
ln = [int(i) for i in input().split(' ')]
time = 0
for i in ln:
if i > time+15:
break
else:
time = i
print(min([time+15, 90])) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, a[100];
cin >> n;
for (i = 0; i <= n - 1; i++) {
cin >> a[i];
}
a[n] = 106;
if (a[0] > 15) {
cout << 15;
} else {
for (i = 0; i <= n - 1; i++) {
if (a[i + 1] - a[i] > 15) {
if (a[i] < 75)
cout << a[i] + 15;
else
cout << 90;
break;
}
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int isP(long int hj) {
long int op;
for (op = 2; op <= sqrt(hj); op++) {
if (hj % op == 0) return 0;
}
return 1;
}
void swap(int *p, int *q) {
int tmp = *p;
*p = *q;
*q = tmp;
}
int main() {
long long int ze, fst, lst, min, min2, c, s, sm1, sm2, sm3, sr, sl, l, ln, rz,
rn, car, ch, eq, r, shr, ng, d, v, curr, spl, fl, z, ev, od, t, m, ct, j,
q, k, b, maxI, max1, max2, lt, md, prev, a, f, n, xP, xN, w, h, d2, d1,
u1, u2, sm, i, p, x, y;
cin >> n;
prev = 0;
f = 0;
for (i = 0; i < n; i++) {
cin >> a;
if ((a - prev) > 15 && f == 0) f = prev + 15;
prev = a;
}
if (f == 0) {
f = a + 15;
if (f > 90) f = 90;
}
cout << f;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int num;
cin >> num;
num += 2;
vector<int> tv(num);
tv[0] = 0, tv[num - 1] = 115;
int ans = 90;
for (int a = 1; a < num; a++) {
cin >> tv[a];
if (tv[a] - tv[a - 1] > 15) {
ans = tv[a - 1] + 15;
break;
}
}
cout << min(90, ans);
}
| 7 | CPP |
#coding:utf-8
def main():
input()
num=[int(i) for i in input().split()]
now=0
last=0
for i in num:
last=now
now=i
if last+15<now :
if last+15 < 90:
print(last+15)
else:
print(90)
return
if now+15<90:
print(now+15)
else:
print(90)
return
# main()
a=int(input())
b=[0]+list(map(int,input().split()))+[90]
for i in range(a+1):
if b[i+1]-b[i]>15:
print(b[i]+15)
exit()
print(90) | 7 | PYTHON3 |
n = int(input())
t = list(map(int, input().split()))
result = t[0] + 15
if t[0] > 15:
result = 15
else:
for i in range(1, len(t)):
if t[i] - t[i-1] <= 15:
result = t[i] + 15
if result > 90:
result = 90
else:
break
print(result) | 7 | PYTHON3 |
n = int(input())
numbers = [int(i) for i in (input().split())]
dur=15
if n==0 or numbers[0]>15:
print(dur)
else:
for i in range(0,n):
if dur>=numbers[i]:
dur=numbers[i]+15
else:
break
if dur < 90:
print(dur)
else:
print(90) | 7 | PYTHON3 |
n = int(input());
a = input().split();
arr = []
for x in a:
arr.append(int(x))
last = 0
if(arr[0]>15):
print("15")
else:
ddd = 1
for i in range(0, len(arr)):
if(i>0):
if(arr[i]-arr[i-1]>15):
s = int(arr[i-1]+15)
if(s>90):
print("90")
else:
print(str(s))
ddd = 0
break
if(i==len(arr)-1):
if(arr[i]<75):
print(arr[i]+15)
else:
print("90") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
;
long long int n;
cin >> n;
long long int arr[n], a;
for (long long int i = 0; i < n; i++) cin >> arr[i];
a = 15;
for (long long int i = 0; i < n; i++) {
if (arr[i] > a) {
cout << min(a, 90ll);
return 0;
} else
a = arr[i] + 15;
}
cout << min(a, 90ll);
}
| 7 | CPP |
import math
n = int(input())
a = list(map(int, input().split()))
t = 0
for i in range(n):
if a[i] > t + 15:
result = t + 15
print(result)
exit()
elif a[i] <= t + 15:
t = a[i]
a[i] += 1
print(min(90, t + 15)) | 7 | PYTHON3 |
n = input()
arr = input().split()
arr1 = list(map(int,arr))
arr1.append(90)
arr1.insert(0,0)
sum=0
for i in range(int(n)+1):
diff = arr1[i+1] - arr1[i]
if diff >15:
sum=arr1[i]+15
break
else:
sum=arr1[i+1]
print(sum) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
int a[n + 2];
a[0] = 0;
bool ok = false;
for (int i = 1; i < n + 1; i++) scanf("%d", &a[i]);
a[n + 1] = 90;
for (int i = 0; i < n + 1; i++) {
if (a[i + 1] - a[i] > 15) {
printf("%d", a[i] + 15);
return 0;
}
}
printf("%d", 90);
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, hold, d, ans;
cin >> n >> hold;
bool flag = 0, lol = 0;
if (hold > 15) {
flag = 1;
} else if (n == 1) {
ans = hold + 15;
}
for (int i = 1; i < n; i++) {
cin >> d;
if (d - hold > 15) {
ans = hold + 15;
} else {
hold = d;
if (i == n - 1) {
ans = hold + 15;
}
if (d > 74) {
lol = 1;
}
}
}
if (flag) {
cout << 15 << endl;
} else if (lol) {
cout << 90 << endl;
} else {
cout << ans << endl;
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 10;
const int MOD = (int)1e9 + 7;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tmp, n, ctr = 0, ans = 0;
cin >> n;
vector<bool> good(91, false);
for (int i = 0; i < n; i++) cin >> tmp, good[tmp] = true;
for (int i = 1; i < 91; i++) {
if (good[i])
ctr = 0, ans = i;
else
ctr++;
if (ctr >= 15) return cout << min(ans + 15, 90), 0;
}
cout << 90;
return 0;
}
| 7 | CPP |
n = int(input())
l = list(map(int, input().split()))
happyMinus = 15
for t in l:
if t <= happyMinus:
happyMinus = t + 15
else:
break
if happyMinus > 90:
happyMinus = 90
print(happyMinus) | 7 | PYTHON3 |
n = int(input())
l = list(map(int,input().split()))
watched = 0
i = 0
while i<n and watched + 15>=l[i]:
watched = l[i]
i+=1
print (min(watched+15,90)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265359;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n, t = 0, a[90], i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a[i];
}
if (a[0] > 15)
cout << 15;
else {
for (i = 0; i < n; i++) {
t = a[i];
if (a[i] + 15 < a[i + 1]) {
break;
}
}
if (t < 75)
cout << t + 15;
else
cout << 90;
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int SS = 5e2 + 123;
const int N = 1e5 + 123;
const int NN = 1e6 + 123;
const int M = 1e7 + 123;
const int MM = 1e8 + 123;
const int inf = 1e9 + 123;
const long long INF = 1e18 + 123;
const long long MAXN = 1e10 + 123;
int a[N], n, k, cnt;
bool eq(int m) {
for (int i = 1; i <= n; i++)
if (m == a[i]) return 1;
return 0;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (k = 1; k <= 90; k++) {
if (cnt == 15) break;
if (!eq(k))
cnt++;
else
cnt = 0;
}
cout << k - 1;
}
| 7 | CPP |
n = int(input())
L = [int(i) for i in input().split()]
R = [0 for _ in range(91)]
for i in L:
R[i] = 1
ans = 0
lim = 15
for i in range(1, 91):
if not lim:
break
if R[i]:
lim = 15
else:
lim -= 1
ans += 1
print(ans)
| 7 | PYTHON3 |
def process(arr, n):
for i in range(1, n + 1):
if arr[i] - arr[i - 1] > 15:
return arr[i - 1] + 15
arr[n] += 15
return arr[n] if arr[n] < 90 else 90
def main():
n = int(input())
arr = [0]
for i in input().split():
arr.append(int(i))
print(process(arr, n))
if __name__ == "__main__": main() | 7 | PYTHON3 |
n=int(input())
a=[int(x) for x in input().split()]
ans=15
for i in a:
if i>ans:
break
else:
ans=i+15
if ans>=90:
print(90)
else:
print(ans) | 7 | PYTHON3 |
n = int(input())
a = map(int, input().split())
b = [False for i in range(90)]
for i in a:
b[i - 1] = True
res, cnt = 0, 0
for i in range(90):
res += 1
if b[i] == False:
cnt += 1
if cnt == 15:
break
else:
cnt = 0
print(res)
| 7 | PYTHON3 |
n = int(input())
a = set(map(int,input().split()))
k = sorted(a)
cnt = 0
for i in range(1,91):
if i not in a:
cnt+=1
else:
cnt = 0
if cnt==15:
if i==14:
print(15)
quit()
print(i)
quit()
print(90) | 7 | PYTHON3 |
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
arr.append(90)
arr.insert(0, 0)
count = 0
for i in range(n+2):
if arr[i] - count > 15:
break
else:
count = arr[i]
if count == 0:
print("15")
elif count >= 90:
print("90")
else:
print(str(count + 15)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
if (a[0] > 15) {
cout << 15 << endl;
return 0;
}
for (int i = 1; i < n; i++) {
if (a[i] - a[i - 1] > 15) {
cout << a[i - 1] + 15 << endl;
return 0;
}
}
if (90 - a[n - 1] > 15)
cout << a[n - 1] + 15 << endl;
else
cout << 90 << endl;
return 0;
}
| 7 | CPP |
n = int(input())
c = set(map(int, input().split()))
x = 0
while x <= 90:
f = False
for i in range(1, 16):
if (x + i) in c:
x = x + i
f = True
if not f:
break
print(min(90, x + 15))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int n;
cin >> n;
long long int ar[n + 1];
long long int idx = 0;
ar[0] = 0;
for (long long int i = 1; i <= n; i++) {
cin >> ar[i];
if (ar[i] - ar[i - 1] <= 15)
idx = i;
else
break;
}
if (ar[idx] + 15 >= 90)
cout << "90" << endl;
else
cout << ar[idx] + 15 << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e2;
const int MAXN = 1e5 + 1;
const int INF = 1e9 + 7;
const long long INFL = 1e18 + 7;
int n;
int a[MXN];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = 1; i <= n; i++) {
if (a[i] - a[i - 1] >= 16) {
cout << a[i - 1] + 15;
return 0;
}
}
cout << min(90, a[n] + 15);
return 0;
}
| 7 | CPP |
n=int(input())
l=list(map(int,input().split()))
if len(l)==1:
if l[0]>15:
time=15
else:
time=l[0]+15
for i in range(len(l)):
if l[i]<=15 and i==0:
continue
elif l[i]>15 and i==0:
time=15
break
if l[i]-l[i-1]>15:
time=l[i-1]+15
break
elif l[i]-l[i-1]<=15:
if i==len(l)-1:
if l[i]<90:
if 90-l[i]<=15:
time=90
elif 90-l[i]>15:
time=l[i]+15
else:
time=90
else:
continue
print(time) | 7 | PYTHON3 |
#n, k = map(int, input().split(" ")) # read multiple integers into different variables
#L = [int(x) for x in input().split()] # read multiple integers into a list
#print(' '.join(map(str, L))) # print multiple integers in one line
n = int(input())
L = [int(x) for x in input().split()]
ct = 0
for i in range(1, 91) :
if i in L : ct = 0
else :
ct+= 1
if ct == 15 : break
if i == 91 : i = 90
print(i) | 7 | PYTHON3 |
def faster():
var1 = int(input())
var2 = list(map(int, input().split()))
if var2[0] > 15:
return 15
elif var1 == 1:
return var2[0]+15
for i in range(var1-1):
if var2[i+1]-var2[i] > 15:
return var2[i] + 15
if var2[len(var2)-1] + 15 <= 90:
return var2[len(var2)-1] + 15
else:
return 90
print(faster()) | 7 | PYTHON3 |
def watch_tv(minutes):
i=0
minutes += [200]
while i <len(minutes) - 1:
if i==0 and minutes[i]>15:
count=15
break
if minutes[i+1]-minutes[i]>15:
count=minutes[i]+15
if minutes[i]>=75:
count=90
break
i+=1
print (count)
n=int(input())
m=[int(x) for x in input().split()]
watch_tv(m)
| 7 | PYTHON3 |
n = int(input())
m = input()
minutes = [int(x) for x in m.split()]
ans = 0
check = False
for i in range(len(minutes)):
if ans + 15 >= minutes[i]:
ans = minutes[i]
else:
ans += 15
check = True
break
if ans + 15 < 90 and check == False:
ans += 15
elif check == False:
ans = 90
print(ans) | 7 | PYTHON3 |
n=int(input())
t=list(map(int,input().split()))
t.append(0)
t=sorted(t)
for i in range(1,len(t)):
if t[i]-t[i-1]>15:
print(t[i-1]+15)
break
else:
if max(t)>74:
print("90")
else:
print(max(t)+15)
| 7 | PYTHON3 |
input()
*a,=map(int,input().split())
b=0
while a[0]<=b+15:
b,*a=a
if not a:break
print(min(90,b+15))
| 7 | PYTHON3 |
input();a=0
for i in map(int,input().split()):
if i-a>15:break
else:a=i
print(min(a+15,90))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k = 0;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
if (a[i] - k <= 15)
k = a[i];
else
break;
}
if (k <= 75)
printf("%d\n", k + 15);
else
printf("90\n");
}
| 7 | CPP |
n = int(input())
tv = (int(i) for i in input().split())
a = 0
for b in tv:
if b-a > 15: break
a = b
time = a+15
if time > 90: print(90)
else: print(time)
| 7 | PYTHON3 |
n=int(input())
l=list(map(int,input().split()))
if(l[0]>15):
print(15)
elif(l[0]<=15 and n==1):
print(l[0]+15)
else:
f=0
l.append(90)
for i in range(1,n+1):
if((l[i]-l[i-1])>15):
s=l[i-1]+15
f=1
break
else:
continue
if f==0:
print(90)
else:
print(s)
| 7 | PYTHON3 |
n = int(input())
a = list(map(int, input().split(' ')))
sum = 0
if n == 1:
if a[0] > 15:
sum = 15
else:
sum = a[0] + 15
else:
if a[0] > 15:
sum = 15
else:
sum = a[0]
for i in range(1, n):
dist = a[i] - a[i-1]
if dist > 15:
sum += 15
break
else:
sum = a[i]
if i == n - 1:
if sum + 15 > 90:
sum = 90
else:
sum += 15
print(sum) | 7 | PYTHON3 |
def getTime(a, b):
if len(b) == 1:
if b[0] > 15:
return(15)
return b[0] + 15
for i in range(a):
if i == 0 and b[0] > 15:
return 15
if b[i] - b[i-1] > 15:
return b[i-1] + 15
if i == len(b) - 1:
if b[i] + 15 > 90:
return 90
return b[i]+15
if __name__ == "__main__":
total = int(input())
minutes = list(map(int,input().split()))
times = getTime(total,minutes)
print(times)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n;
bool m[100];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
int t;
scanf("%d", &t);
m[t] = true;
}
for (int i = 0, j = 0; i <= 90; i++, j++) {
if (j > 15) {
printf("%d", i - 1);
return 0;
}
if (m[i]) j = 0;
}
printf("%d", 90);
}
| 7 | CPP |
def BearAndGame(n, a):
time = 15
for i in range(len(a)):
if time >= a[i]:
time = a[i]
time += 15
if time > 90:
time = 90
return time
n = int(input())
a = [int(x) for x in input().split()]
print(BearAndGame(n,a))
| 7 | PYTHON3 |
n = int(input())
t = [0, ]
t += input().split(' ')
t += ['90']
time = 90
for i in range(n + 1):
t[i+1] = int(t[i+1])
if t[i+1] - t[i] > 15:
time = t[i] + 15
break
print(time)
| 7 | PYTHON3 |
n=int(input())
temp=[]
list=[int(i) for i in input().split()]
list.insert(0,0)
for i in range(n):
temp.append(list[i+1]-list[i])
i=0
while(i<n):
if(temp[i]>15):
break
i+=1
if(list[i]+15>=90):
print(90)
else:
print(list[i]+15) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[100010];
int main() {
int n;
cin >> n;
int pre = 0;
for (int i = 0; i < n; ++i) {
int next;
cin >> next;
if (next - pre > 15) {
cout << (pre + 15) << endl;
return 0;
}
pre = next;
}
cout << min(90, pre + 15) << endl;
}
| 7 | CPP |
n = int(input())
k = [int(i) for i in input().split(' ')]
if k[0] > 15:
print(15)
else:
i = 1; c = k[0] + 15
while i < n:
if c >= k[i] and c != 90:
c = k[i] + 15
i += 1
if c >= 90:
print(90)
else: print(c) | 7 | PYTHON3 |
n = int(input())
a = list(input().split(' '))
a = list(int(x) for x in a)
res = a[0]
flag = True
if a[0] <= 15:
for i in range(1, n):
if a[i] - a[i - 1] > 15:
res += 15
flag = False
break
else:
res = a[i]
else:
res = 0
if flag:
if res + 15 <= 90:
res += 15
else:
res = 90
print(res)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[95], p = 0, j = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i == 0) {
if (a[i] > 15) {
cout << 15;
p = 1;
break;
} else if (n == 1 && a[i] <= 15) {
cout << a[i] + 15;
p = 1;
break;
}
} else {
if (a[i] - a[i - 1] > 15) {
cout << a[i - 1] + 15;
p = 1;
break;
}
}
}
if (p == 0 && a[n - 1] <= 15)
cout << a[n - 1] + 15;
else if (p == 0 && a[n - 1] > 15 && a[n - 1] <= 75)
cout << a[n - 1] + 15;
else if (p == 0 && a[n - 1] > 75)
cout << 90;
return 0;
}
| 7 | CPP |
input()
l=0
for x in map(int,input().split()):
if x>l+15: break
l=x
print (min(l+15,90)) | 7 | PYTHON3 |
n=int(input())
good=[0]+[int(z) for z in input().split()]+[90]
result=90
for i in range(1,n+2):
if good[i]-good[i-1]>15:
result=min(result,good[i-1]+15)
break
print(result) | 7 | PYTHON3 |
if __name__ == "__main__":
n, x = int(input()), [0] + [int(i) for i in input().split()] + [90]
for i in range(1, len(x)):
if x[i] - x[i-1] > 15:
print(x[i-1] + 15)
exit()
print(90)
| 7 | PYTHON3 |
n = int(input())
s = list(map(int, input().split()))
s.append(90)
Cnt = 0
if s[0] > 15:
Cnt += 15
else:
Cnt += s[0]
for k in range(1, n + 1):
if s[k] - s[k - 1] <= 15:
Cnt += s[k] - s[k - 1]
else:
if Cnt + 15 > 90:
Cnt += (90 - s[k])
else:
Cnt += 15
break
print(Cnt) | 7 | PYTHON3 |
n = int(input()); m = 90
L = [0]+[int(x) for x in input().split()]+[90]
for i in range(1, n+2):
if L[i]-L[i-1] > 15: m = min(L[i-1]+15, 90); break
print(m)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
int a;
int c = 0;
cin >> n;
vector<int> v;
v.push_back(0);
for (i = 0; i < n; i++) {
cin >> a;
v.push_back(a);
}
for (i = 0; i < (v.size() - 1); i++) {
if ((v[i + 1] - v[i]) <= 15)
continue;
else {
c = 1;
break;
}
}
if (c == 1)
cout << v[i] + 15 << endl;
else {
int x = v[n] + 15;
if (x > 90)
cout << "90" << endl;
else
cout << x << endl;
}
}
| 7 | CPP |
n=int(input())
l=list(map(int,input().split()))
t=0
for i in range(1,91):
t+=1
if i in l: t=0
if t==15: print(i); break
else: print(90) | 7 | PYTHON3 |
n=int(input())
a=list(map(int,input().split()))
if a[0]>15:
print(15)
else:
i=0
c=0
while c!=1 and i!=n-1:
if a[i+1]-a[i]>15:
c=1
else:
i+=1
print(min(a[i]+15,90))
| 7 | PYTHON3 |
n = int(input())
l = list(map(int,input().split()))
ans1 = 0
ans = 0
if l[0] > 15:
print(15)
elif l[0] <= 15 and n == 1:
print(l[0]+15)
else:
for i in range(len(l)-1):
if abs(l[i]-l[i+1]) > 15:
print(l[i]+15)
exit()
else:
ans = l[i+1]
ans1 += 1
if ans > 75:
print(90)
else:
print(ans+15)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int n, temp, a, tahan;
int main() {
scanf("%d", &n);
for (int i = int(1); i <= int(n); i++) {
scanf("%d", &temp);
v.push_back(temp);
}
a = 0;
for (int i = int(0); i <= int(n - 1); i++) {
if (v[i] - a > 15) {
printf("%d\n", a + 15);
return 0;
} else {
a = v[i];
}
}
printf("%d\n", min(90, a + 15));
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int ok[91];
int main() {
int n, x;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
ok[x] = 1;
}
for (int i = 15; i <= 90; i++) {
int interesting = 0;
for (int j = i - 15 + 1; j <= i; j++) {
interesting += ok[j];
}
if (!interesting) {
cout << i << '\n';
return 0;
}
}
cout << 90 << '\n';
return 0;
}
| 7 | CPP |
n=int(input())
l=list(map(int,input().split()))
c,flag=l[0],0
if l[0]>15:
print('15')
exit()
for i in range(1,n):
if l[i]-l[i-1]>15:
c+=15
flag=1
break
else:
c=l[i]
if 90-l[-1]>15 and flag==0:
print(l[-1]+15)
exit()
print([c,'90'][flag==0]) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int minutes[n];
int result = -1;
int lastN = 0;
for (int i = 0; i < n; i++) {
cin >> minutes[i];
if (i == 0 && minutes[0] > 15) {
result = 15;
} else if (result < 0 && minutes[i] - minutes[i - 1] > 15) {
result = minutes[i - 1] + 15;
}
}
if (result < 0) {
result = minutes[n - 1] + 15;
}
if (result > 90) {
result = 90;
}
cout << result;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(100, 0);
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a[x]++;
}
int now = 0;
for (int i = 1; i <= 90; i++) {
if (a[i] == 1)
now = 0;
else {
now++;
if (now == 15) {
cout << i;
return 0;
}
}
}
cout << 90;
}
| 7 | CPP |
n = int(input())
m = list(map(int, input().split(' ')))
last = 15
if len(m) > 0:
for i in range(n):
if m[i] <= last:
last = m[i] + 15
last = min(last, 90)
print(last)
| 7 | PYTHON3 |
import sys
n = int(input())
t = list(map(int, input().split(' ')))
last = 0
for i in range(0, n):
if t[i] - last > 15:
print(last+15)
sys.exit(0)
last = t[i]
print(min(t[-1] + 15, 90)) | 7 | PYTHON3 |
#!/usr/bin/python
# http://codeforces.com/problemset/problem/673/A
# define function
def watch_time(n, a):
interesting_minute = a
minute = 0;
interesting_minute.insert(0, 0)
interesting_minute.insert(len(interesting_minute), 90)
for index in range(1, len(interesting_minute)):
if interesting_minute[index] - interesting_minute[index - 1] > 15:
minute = interesting_minute[index - 1] + 15
break
if interesting_minute[index] == 90:
minute = 90
return minute
# call function
n = int(input())
a = [int(i) for i in input().split()]
print(watch_time(n, a))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> A(n);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int a = 0, b;
for (int i = 0; i < n; i++) {
if (A[i] - a > 15) {
cout << (a + 15) << endl;
return 0;
}
a = A[i];
}
cout << min(90, a + 15) << endl;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int ar[1000];
int main() {
int nn;
cin >> nn;
for (int i = 0; i < nn; i++) {
cin >> ar[i];
}
if (ar[0] > 15) {
cout << 15 << "\n";
return 0;
}
for (int i = 1; i < nn; i++) {
if (ar[i] - ar[i - 1] > 15) {
cout << ar[i - 1] + 15 << "\n";
return 0;
}
}
if (ar[nn - 1] + 15 < 90) {
cout << ar[nn - 1] + 15 << "\n";
return 0;
}
cout << 90 << "\n";
}
| 7 | CPP |
n = int(input())
l = list(map(int, input().split()))
last_interesting = 0
_min = 0
l.append(100000)
for i in l:
if i - last_interesting > 15:
_min += 15
break
_min += (i - last_interesting)
last_interesting = i
print(min(_min, 90))
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
template <class T>
const T& max(const T& a, const T& b, const T& c) {
return max(a, max(b, c));
}
template <class T>
const T& min(const T& a, const T& b, const T& c) {
return min(a, min(b, c));
}
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long poww(long long a, long long b) {
if (b == 0) return 1;
long long tmp = poww(a, b / 2);
return (b & 1 ? a * tmp * tmp : tmp * tmp);
}
double poww(double a, int b) {
if (b == 0) return 1;
double tmp = poww(a, b / 2);
return (b & 1 ? a * tmp * tmp : tmp * tmp);
}
long long sumOfDigs(string s) {
long long sum = 0;
for (int i = 0; i < s.length(); i++) sum += s[i] - '0';
return sum;
}
long long sumOfDigs(long long n) {
return (n < 10 ? n : n % 10 + sumOfDigs(n / 10));
}
string itos(long long i) {
string s = "";
while (i) {
s += char(i % 10 + '0');
i /= 10;
}
reverse(s.begin(), s.end());
return s;
}
long long stoi(string& s) {
long long tot = 0;
for (int i = (int)s.length() - 1, j = 1; i >= 0; i--, j *= 10) {
tot += j * (s[i] - '0');
}
return tot;
}
long long mod = poww(10, 6) + 3;
int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
using namespace std;
void t() { freopen("test.txt", "r", stdin); }
bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
return a.second < b.second;
}
int a[1000];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
int curr = 0;
for (int i = 1; i <= n; i++) {
if (a[i] - curr > 15) {
return cout << (curr + 15) << endl, 0;
} else
curr = a[i];
}
if (curr + 15 > 90)
return cout << 90 << endl, 0;
else
return cout << curr + 15 << endl, 0;
return 0;
}
| 7 | CPP |
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(1,91):
if i == 90:
print(i)
elif i in l:
count = 0
else:
count += 1
if count == 15:
print(i)
break | 7 | PYTHON3 |
n = int(input())
t = list(map(int,input().split()))
t.insert(0,0)
k = [15+t[i] for i in range(n) if t[i+1]-t[i]>15]
if len(k)==0: print([90,t[-1]+15][90-t[-1]>=15])
else: print(k[0]) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
scanf("%d", &n);
int t;
int prev = 0;
int res = 0;
for (int i = 0; i < n; ++i) {
scanf("%d", &t);
if (t - prev <= 15) {
res = prev = t;
}
}
cout << min(90, res + 15);
}
int main() {
solve();
return 0;
}
| 7 | CPP |
n = int(input())
t = [int(x) for x in input().split()]
cur = 0
time = 0
for i in range(n):
if (t[i] - cur > 15):
time = cur + 15
break
cur = t[i]
if(cur + 15 >= 90):
time = 90
else:
time = cur + 15
print(time)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n;
int a[111];
int main() {
cin >> n;
while (n--) {
int x;
cin >> x;
a[x] = 1;
}
int bored = 0;
int i;
for (i = 1; i <= 90; i++) {
if (!a[i])
bored++;
else
bored = 0;
if (bored == 15) break;
}
cout << min(i, 90) << endl;
return 0;
}
| 7 | CPP |
n=int(input())
a=[int(x) for x in input().split()]
p=0
for i in range(n):
if a[i]-p>15:
break
p=a[i]
print(min(p+15,90))
| 7 | PYTHON3 |
line1 = input()
line2 = input()
tempt = [0] + line2.split(' ')
minute = int(tempt[-1])
for i in range(len(tempt) - 1):
if int(tempt[i + 1]) - int(tempt[i]) > 15:
minute = int(tempt[i])
break
if minute + 15 > 90:
print(90)
else:
print(minute + 15) | 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 14 16:30:15 2018
@author: Quang Huy
"""
n= int(input())
x= input()
list1 = x.split()
d=0
list1.append(90)
for i in range(n+1):
if (int(list1[i])-d<=15):
d= int(list1[i])
else:
d+=15
break
print(d) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, time = 0, value;
scanf("%d", &n);
vector<int> v1;
for (int i = 0; i < n; i++) {
scanf("%d", &value);
v1.push_back(value);
}
for (int i = 0; i < n; i++) {
if (i + 1 == v1.size()) {
if (v1[i] - time > 15) {
cout << (time + 15) << endl;
return 0;
} else {
time = time + abs(v1[i] - time);
if (time != 90) {
time = time + 15;
if (time > 90) time = 90;
}
cout << time << endl;
return 0;
}
} else {
if (abs(time - v1[i]) > 15) {
time += 15;
cout << time << endl;
return 0;
} else
time = time + abs(time - v1[i]);
}
}
cout << time << endl;
return 0;
}
| 7 | CPP |
n = int(input())
a = list(map(int,input().split()))
minA = 0
for i in a:
if i - minA > 15:
break
else:
minA = i
if(minA + 15 > 90): minA = 90
else: minA += 15
print(minA)
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n;
int ar[n];
for (int i = 0; i < n; i++) {
cin >> ar[i];
}
if (ar[0] > 15) {
cout << 15;
return 0;
}
for (int i = 1; i < n; i++) {
if (ar[i] - ar[i - 1] > 15) {
cout << ar[i - 1] + 15;
return 0;
}
}
if (ar[n - 1] < 75) {
cout << ar[n - 1] + 15;
return 0;
}
cout << 90;
}
| 7 | CPP |
n = int(input())
a = list(map(int, input().split()))
prev = 0
for x in a:
if x - prev > 15:
break
prev = x
print(min(prev + 15, 90)) | 7 | PYTHON3 |
n = int(input())
arr = list(map(int,input().split()))
# arr = [15, 20, 30, 40, 50, 60, 70, 80, 90]
def minMinute(arr):
t = 0
for i in range (len(arr)):
if arr[i] - t > 15:
return min(90,t+15)
else:
t = arr[i]
return min(t+15, 90)
print(minMinute(arr)) | 7 | PYTHON3 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.