id
int64
251M
307M
language
stringclasses
11 values
verdict
stringclasses
119 values
source
stringlengths
0
60.3k
problem_id
stringclasses
500 values
type
stringclasses
2 values
difficulty
stringclasses
4 values
259,739,466
C++17 (GCC 7-32)
WRONG_ANSWER on test 8
//#pragma GCC optimize("Ofast,O3,unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define bp __builtin_popcountll #define mp make_pair #define pb push_back #define vec vector #define ll long long #define F first #define S second #define ld long double #define pii pair <int, int> #define ...
1970A2
wrong_submission
hard
288,715,373
PyPy 3-64
TIME_LIMIT_EXCEEDED on test 8
import sys input = sys.stdin.readline def check(a, t): while 1: a += t if x[a]: break return a def calc(s): c = 0 for i in s: if i == '(': c += 1 else: c -= 1 if c < 0: return 0 return 1 s = input()[:...
1970A2
wrong_submission
hard
259,474,103
Java 8
WRONG_ANSWER on test 8
import java.util.*; public class Main { static class Pair implements Comparable<Pair> { int first, second; Pair(int first, int second) { this.first = first; this.second = second; } public int compareTo(Pair other) { if (this.first != other.fi...
1970A2
wrong_submission
hard
259,550,499
Java 8
WRONG_ANSWER on test 8
import java.util.*; import java.io.*; public class Main { static PrintWriter pw = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); static class Pair implements Comparable{ Integer x ; Integer y ; Integer z ; public Pair(Integer i, Integer j,Inte...
1970A2
wrong_submission
hard
266,329,399
PyPy 3-64
WRONG_ANSWER on test 10
def shuffle(x): balance = 0 items = [] index = 0 for c in x: items.append( (balance, -index, c) ) index += 1 balance += 1 if c == '(' else -1 items.sort() return "".join( [i[2] for i in items] ) class Tree: def __init__(self): self.children = [] root = Tree() layer = [root] pos = [0] for x in i...
1970A2
wrong_submission
hard
278,513,807
C++20 (GCC 13-64)
OK
#include <bits/stdc++.h> using i64 = long long; void solve() { int n; std::cin >> n; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } int m = 0; i64 sum = 0; int max = 0; for (int i = 0; i < n; i++) { m = std::max(m, a[i]); ...
1987B
right_submission
none
268,136,942
C++20 (GCC 13-64)
OK
/** * author: tourist * created: 30.06.2024 17:35:58 **/ #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) { int n; cin >> n; vec...
1987B
right_submission
none
268,247,663
C++20 (GCC 13-64)
OK
/* * @Author: hungeazy * @Date: 2024-06-30 21:22:22 * @Last Modified by: hungeazy * @Last Modified time: 2024-06-30 22:07:06 */ #include <bits/stdc++.h> // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") using namespace std; #define fast i...
1987B
right_submission
none
275,866,412
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
using namespace std; #include<bits/stdc++.h> #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define ll long long int main() { int t = 0; cin >> t; while (t--) { int n; cin >> n; int count = 0; vector<int> changed; int prev_val = -1; ...
1987B
wrong_submission
easy
268,337,818
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; // #define ll long long int #define inf INT_MAX #define ninf INT_MIN #define lmax LONG_MAX #define lmin LONG_MIN #define vi vector<int> #define vll vector<long long int> const int mod=1e9+7; #define next "\n" #define srt(x) sort((x).begin(), (x).end()) #define dsrt(x...
1987B
wrong_submission
easy
268,151,079
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define ll long long using namespace std; void setIO(string name = ""){ cin.tie(0)->sync_with_stdio(0); if ((ll)(name.size())){ freopen((name + ".in").c_str(), "r", stdin); freopen((name + ".out").c_str(), "w", stdout); } } template<typename T1, typename T2> // cin >> pair<T1, T2...
1987B
wrong_submission
easy
268,199,244
Python 3
WRONG_ANSWER on test 2
def asd(arr, n): if arr == [344, 12, 37, 60, 311, 613, 365, 328, 675]: return 1490 + 331 else: mx = arr[0] s = 0 for i in arr: if i < mx: s += mx - i else: mx = i return s + 1 for _ in range(int(input())): n = in...
1987B
wrong_submission
easy
270,016,170
Python 3
WRONG_ANSWER on test 2
loop = int(input()) for i in range(loop): n = int(input()) a = list(map(int, input().split())) store=0 to_print=0 first_instant=0 for j in range(n - 1 ): dy=j+1 if a[j]>a[dy]: diff = a[j] - a[dy] a[dy] += diff store += diff ...
1987B
wrong_submission
easy
268,296,954
PyPy 3
WRONG_ANSWER on test 2
a = [] for i in range(int(input())): n = int(input()) l = list(map(int, input().split())) mx = 0 for i in range(1,n): mx = max(mx,l[i-1]-l[i]) ans = 0 for i in range(1,n): if l[i] < l[i-1]: ans+=(l[i-1]-l[i]) l [i] = l[i-1] a.append(ans+mx) for i in a...
1987B
wrong_submission
easy
271,173,456
Java 8
WRONG_ANSWER on test 2
import java.util.*; public class KSort { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t--!=0){ int n = sc.nextInt(); int arr[] = new int[n]; for(int i=0; i<n; i++){ arr[i]...
1987B
wrong_submission
easy
275,643,883
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int k = 0; int maxInc = 0; int n = sc.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ arr[i]...
1987B
wrong_submission
easy
268,171,547
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n; cin>>n; long long arr[n]; for(int i=0; i<n; i++){ cin>>arr[i]; } long long num=arr[0]; vector<long long> store; for(int i=1; i<n; i++){ ...
1987B
wrong_submission
medium
275,514,693
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; } int k = 0 ; int big = a[0]; int ideal[n]; ideal[0] = a[0]; for(int i = 1; i < n; i++...
1987B
wrong_submission
medium
275,689,884
Python 3
TIME_LIMIT_EXCEEDED on test 2
test_cast = int(input()) answerpool = [] for i in range(test_cast): lengthofeach = int(input()) -1 test = list(map(int,input().split())) cost = 0 while True: indice = set() for i in range(lengthofeach): n =i+1 while test[i] > test[n]: indice.add...
1987B
wrong_submission
medium
268,192,068
PyPy 3-64
WRONG_ANSWER on test 2
import sys import math input = sys.stdin.readline for _ in range(int(input())): n=int(input()) arr=list(map(int,input().split())) if n==1: print(0) else: x=0 maxi=arr[0] one,two=0,0 work=True for i in range(1,len(arr)): if arr[i]<maxi: ...
1987B
wrong_submission
medium
269,193,971
Java 21
WRONG_ANSWER on test 2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class CF1987B { public static void main(String[] args) throws IOException { BufferedReader br = new ...
1987B
wrong_submission
medium
298,057,225
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t>0){ int n=sc.nextInt(); int[] arr=new int[n]; for(int i=0; i<n; i++){ arr[i]=sc.nextInt(); ...
1987B
wrong_submission
medium
269,747,259
Python 3
TIME_LIMIT_EXCEEDED on test 2
t = int(input()) for i in range (t): n = int(input()) a = list(map(int,input().split())) cnt = 0 while a!=sorted(a): y = [] j = 0 while j<n: k = j+1 while k<n and a[k]<a[j]: y.append(k) k+=1 j = k for p in y: a[p]+=1 cnt += len(y)+1 # print (cnt) ...
1987B
wrong_submission
hard
268,168,144
PyPy 3-64
WRONG_ANSWER on test 2
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.write if self.writabl...
1987B
wrong_submission
hard
268,189,204
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Ques{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); while(t>0){ int n=in.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ arr[i]=in.nextInt(); ...
1987B
wrong_submission
hard
268,218,209
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Epic_2024_B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = Integer.parseInt(scanner.next()); for (int k = 0; k < t; k++) { int n = Integer.parseInt(scanner.next()); int[] a = new int[n]; ...
1987B
wrong_submission
hard
268,188,796
C++17 (GCC 7-32)
TIME_LIMIT_EXCEEDED on test 5
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int t; cin>>t; while(t--){ int n;int k; cin>>n; int arr[n];vector<int>v;int sum=0; for(int i=0;i<n;i++){ cin>>arr[i]; } for(int i=1;i<n;i++){ int max=*max_element(arr,arr+i); if...
1987B
wrong_submission
hard
268,175,842
C++17 (GCC 7-32)
TIME_LIMIT_EXCEEDED on test 5
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cmath> #include <map> #include <set> #include <stack> #include <queue> #define ll long long using namespace std; int main() { int t; cin >> t; while (t--) { ll n; cin >> n; vector<ll> a(n); ...
1987B
wrong_submission
hard
295,020,549
Python 3
OK
for _ in range(int(input())): n,m=map(int,input().split()) ln=0;ans=0; for i in range(n): ln+=len(input()) if ln<=m:ans+=1 print(ans)
2050A
right_submission
none
295,055,539
Python 3
OK
7 # t = int(input()) # for _ in range(t): # n, r = map(int, input().split()) # familyMemberList = list(map(int, input().split())) # totalFamilyMembers = sum(familyMemberList) # emptySeat = (2 * r) - totalFamilyMembers # unhappyPeople = 0 # if emptySeat == 0: # for i in range(n): #...
2050A
right_submission
none
304,808,994
PyPy 3-64
OK
def max_words_on_strip(test_cases): results = [] for case in test_cases: n, m, words = case total_length = 0 x = 0 for word in words: if total_length + len(word) <= m: total_length += len(word) x += 1 else: b...
2050A
right_submission
none
297,912,490
Java 21
OK
import java.util.*; public class linebreaks { public static void main(String[] args) { Scanner as=new Scanner(System.in); int tc; tc=as.nextInt(); int i; for(i=0;i<tc;i++) { int n,m; n=as.nextInt();m=as.nextInt(); int j; String arr[]=new String[n]; int arr1[]=new ...
2050A
right_submission
none
298,739,086
Java 8
OK
import java.util.Scanner; import java.util.*; public class LineBreaks { public static void main(String[]args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int i = 0;i<T;i++) { int N = sc.nextInt(); int M = sc.nextInt(); sc.nextLine(); int steps = 0; for(int j = 0;j<N;j++) ...
2050A
right_submission
none
299,007,222
Java 21
OK
import java.util.*; public class p1{ public static void main(String args []){ Scanner sc=new Scanner(System.in); int words=0; int t,i,n,m,x=0; char ch; t=sc.nextInt(); while(t>0){ n=sc.nextInt(); m=sc.nextInt(); String s[]=new String[n]; ...
2050A
right_submission
none
294,987,984
C++17 (GCC 7-32)
OK
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long ll mult(ll a,ll b ,ll mod){return ((a%mod) * (b%mod))% mod;} ll add(ll a,ll b ,ll mod){return ((a%mod) + (b%mod))% mod;} ll binpow(ll base,ll exp,ll mod){ll res=1;while(exp>0){if(exp & 1)res=mult(res,base,mod);base= mul...
2050A
right_submission
none
295,686,607
C++17 (GCC 7-32)
OK
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here int t; cin>>t; while(t--){ int m,n,x=0,sum=0; cin>>n>>m; while(n--){ string str; cin>>str; int a=str.length(); sum=sum+a; if(sum<=m) ...
2050A
right_submission
none
296,118,117
C++17 (GCC 7-32)
OK
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define tezi() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define samay() srand(chrono::high_resolution_clock::now().time_since_epoch().count()); typedef long double ld; #define ff first #define ss second int main(){ tezi(); samay(); ...
2050A
right_submission
none
294,987,464
C++20 (GCC 13-64)
OK
/** * author: tourist * created: 05.12.2024 19:35:00 **/ #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt; cin >> tt; while (tt--) { int n, x; cin >> n...
2050A
right_submission
none
295,025,896
C++23 (GCC 14-64, msys2)
OK
#include <bits/stdc++.h> using i64 = long long; using u64 = unsigned long long; using u32 = unsigned; using u128 = unsigned __int128; void solve() { int n, m; std::cin >> n >> m; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::string s; std::cin >> s; a[i] = s....
2050A
right_submission
none
295,043,305
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <stdio.h> #include <string.h> int main(){ int t; scanf("%d",&t); while(t--){ int n,m; scanf("%d %d",&n,&m); char arr[n][10]; for(int i=0;i<n;i++){ scanf("%s",arr[i]); } int len=0; int x=0; for(int i=0;;i++){ ...
2050A
wrong_submission
easy
296,887,967
C++17 (GCC 7-32)
RUNTIME_ERROR on test 2
#include<iostream> #include<vector> using namespace std; int main(){ int t; cin >> t; while(t--){ int n,m; cin>>n>>m; vector<int> x(n); x[0]=0; int k=0; string temp; for(int i=1;i<=n;i++){ cin>>temp; x[i]=temp.size()+x[i-1]; if(m>=x[i]) k++; } cout<< k...
2050A
wrong_submission
easy
295,021,857
C++17 (GCC 7-32)
RUNTIME_ERROR on test 2
#include <iostream> #include <string> #include <queue> using namespace std; int main() { int t; cin >> t; while (t > 0) { t--; int n, m; cin >> n >> m; queue<string>q; while (n--) { string s; cin >> s; q.push(s); } long long total = 0; int cnt = 0; while (total < m) { total += (q.front(...
2050A
wrong_submission
easy
295,380,885
Python 3
WRONG_ANSWER on test 2
T=int(input()) for _ in range(T): cnt=0 c=[] n,m=map(int,input().split()) for j in range(n): a=input() b=len(a) c.append(b) for i in c: m-=i cnt+=1 if m==0: print(cnt) break if m<0: print(cnt-1) b...
2050A
wrong_submission
easy
295,034,139
Python 3
WRONG_ANSWER on test 2
for _ in range(int(input())): n,m = map(int,input().split()) words = [input() for i in range(n)] c = len(words[0]) count=1 for i in range(1,n): if c==m: print(count) break if c>m: print(count-1) break c+=len(words[i]) co...
2050A
wrong_submission
easy
298,467,489
Python 3
WRONG_ANSWER on test 2
t = int(input()) for _ in range(t): n, m = map(int, input().split()) lista = [input().strip() for _ in range(n)] if len(lista[0]) > m: print(0) else: s = 0 nb = 0 for j in range(len(lista)): if s + len(lista[j]) <= m: s += len(lista[j])...
2050A
wrong_submission
easy
295,008,644
Java 21
WRONG_ANSWER on test 2
import java.util.Arrays; //import java.util.ArrayList; //import java.util.Collection; //import java.util.HashMap; //import java.util.Map; import java.util.Scanner; //import java.util.Set; public class Main { public static void main(String[] args) { Scanner S = ...
2050A
wrong_submission
easy
295,143,638
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class A_Line_Breaks{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while(t-->0){ int n = sc.nextInt(); int m = sc.nextInt(); sc.nextLine(); ...
2050A
wrong_submission
easy
295,078,545
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define f first #define s second #define pb push_back #define lb lower_bound #define ub upper_bound #define pi pair<int, int> #define bg begin() #define en end() #define sz(x) (int)x.size() #define all(x) x.begin(), x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(false...
2050A
wrong_submission
medium
295,235,223
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; signed main() { //freopen("rect.in", "r", stdin); //freopen("rect.out", "w", stdout); int T; cin >> T; while(T--){ int n,m; cin >> n >> m; ...
2050A
wrong_submission
medium
295,331,721
Python 3
WRONG_ANSWER on test 2
cases = int(input()) for i in range(cases): nm = input().split(" ") n = int(nm[0]) m = int(nm[1]) count = 0 while count < n and m >= 0: m -= len(input()) count += 1 print(count if m == 0 else (count - 1)) while count < n: input() count += 1
2050A
wrong_submission
medium
302,236,672
Python 3
RUNTIME_ERROR on test 2
def code(num): for i in range(num): inp = input().split(" ") lst = [None]*int(inp[0]) for j in range(int(inp[0])): lst[j] = input() limit = int(inp[1]) count = 0 while True: limit -= len(lst[count]) if limit ==...
2050A
wrong_submission
medium
296,281,229
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- >0) { int ans=0; int current=0; int n=scanner.nextInt(); int m = sc...
2050A
wrong_submission
medium
295,054,016
Java 8
RUNTIME_ERROR on test 2
import java.util.ArrayList; import java.util.Scanner; public class Solutions { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ArrayList<String> words = new ArrayList<>(); String minLengthString = null; int x; int t = scanner.nextInt();/...
2050A
wrong_submission
medium
295,014,781
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int main (){ int t; cin >> t; while(t--) { int n, m; cin >> n >> m; string s[n]; for (int i = 0; i < n; i++) { cin >> s[i]; } int sum = 0; for (int i = 0; i < n; i++) { sum += s[i]....
2050A
wrong_submission
hard
299,141,731
C++23 (GCC 14-64, msys2)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n, m; cin>> n >> m; vector<string> v(n); for(int i=0; i<n; i++) cin>> v[i]; int ct=0; in...
2050A
wrong_submission
hard
296,432,629
Python 3
RUNTIME_ERROR on test 2
sint = lambda: int(input()) mint = lambda: map(int, input().split()) aint = lambda: list(map(int, input().split())) for _ in range(int(input())): n, m = mint() words = [] for _ in range(n): words.append(input()) words_fit = 0 total_count = 0 i = 0 while total_count < m: tot...
2050A
wrong_submission
hard
295,010,554
Python 3
WRONG_ANSWER on test 2
t=int(input()) for _ in range(t): n,m=map(int,input().split()) a=0 b=0 k=n e=0 o=True for i in range(k): s=input() a+=len(s) b+=1 if a>m and o: e=b-1 o=False if a==m and o: e = b o = False print(e)
2050A
wrong_submission
hard
295,022,457
Java 21
WRONG_ANSWER on test 2
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class strip { public static StringTokenizer st = new StringTokenizer(""); public s...
2050A
wrong_submission
hard
295,006,006
Java 21
WRONG_ANSWER on test 2
import java.util.Scanner; public class Sol{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int i,n,m,t = sc.nextInt(),sum; int[] arr; while(t-- != 0) { n = sc.nextInt(); m = sc.nextInt(); arr = new int[n]; ...
2050A
wrong_submission
hard
262,665,713
C++20 (GCC 13-64)
OK
#include <bits/stdc++.h> using i64 = long long; void solve() { int n; std::cin >> n; std::vector<int> p(n); for (int i = 0; i < n; i++) { std::cin >> p[i]; } if (std::is_sorted(p.begin(), p.end())) { std::cout << 1LL * (2 * n) * (2 * n + 1) / 2 << "\n"; retu...
1973E
right_submission
none
269,155,494
C++20 (GCC 13-64)
OK
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef pair<int, int> pii; ...
1973E
right_submission
none
261,604,180
C++20 (GCC 13-64)
OK
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define fi first #define se second typedef pair<int, int> pii; #define endl "\n" #define INF 0x3f3f3f3f3f3f3f3f #define inf 0x3f3f3f3f // 注意,memset赋值负无穷是0xC0,得出的值是-0x3f-1 #define eps 1e-8 // double 型memset最大127,最小128,int memset赋值-1...
1973E
right_submission
none
262,031,892
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> #define ll long long using namespace std; inline int read(){ int a=0,b=1;char c=getchar(); for(;c<'0'||c>'9';c=getchar())if(c=='-')b=-1; for(;c>='0'&&c<='9';c=getchar())a=a*10+c-'0'; return a*b; } int a[100001],b[100001]; int main() { int T=read(); while(T--) { int n=read(); int Max=0...
1973E
wrong_submission
easy
262,349,158
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; // typedef is used to create an alias for a data type typedef long long ll; typedef long long int lli; typedef unsigned long long int ull; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<lli> vlli; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typede...
1973E
wrong_submission
easy
261,356,564
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include "bits/stdc++.h" using namespace std; #pragma GCC optimize("Ofast","inline","-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #define int long long int a[100001],n; void Delta() { cin >> n; for(int i=1;i<=n;++i) cin >> a[i]; int cnt=0,mx=0,mn=2147483647,s=0; for(int i=1;i<=n;++i) i...
1973E
wrong_submission
easy
292,504,999
PyPy 3-64
WRONG_ANSWER on test 2
import heapq import os, sys from io import BytesIO, IOBase from collections import defaultdict, deque, Counter from bisect import bisect_left, bisect_right from heapq import heappush, heappop from functools import lru_cache, reduce from itertools import accumulate from operator import xor import random import math im...
1973E
wrong_submission
easy
261,408,496
PyPy 3-64
WRONG_ANSWER on test 2
from sys import stdout from sys import stdin from math import ceil I=lambda:list(map(int,input().split())) n=int(input()) for i in range(n): N=int(input()) P=I() dis=0 dmi=999999 dma=0 for i in range(N): if P[i]!=i+1: dis+=1 dmi=min(dmi,i) dma=max(dma,...
1973E
wrong_submission
easy
261,406,213
PyPy 3-64
WRONG_ANSWER on test 2
import sys import heapq input = sys.stdin.readline def fg(): return int(input()) def fgh(): return [int(xx) for xx in input().split()] def tt(): sys.stdout.flush() def sd(): print('Yes') def df(): print('No') for __ in range(fg()): n = fg() p = fgh() if p == sorted(p): print(2 * ...
1973E
wrong_submission
easy
261,391,798
Java 8
WRONG_ANSWER on test 2
import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1973 { static final int INF = Integer.MAX_VALUE/2; public static void main(String[] args) throws Exception { FastScanner infile = new FastScanner(); int T = infile.nextInt(); while(T-->0) { ...
1973E
wrong_submission
easy
261,378,208
Java 8
WRONG_ANSWER on test 2
import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1973 { static final int INF = Integer.MAX_VALUE/2; public static void main(String[] args) throws Exception { FastScanner infile = new FastScanner(); int T = infile.nextInt(); while(T-->0) { ...
1973E
wrong_submission
easy
261,395,538
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#ifndef LOCAL #define FAST_IO #endif // ============ #include <bits/stdc++.h> #define OVERRIDE(a, b, c, d, ...) d #define REP2(i, n) for (i32 i = 0; i < (i32)(n); ++i) #define REP3(i, m, n) for (i32 i = (i32)(m); i < (i32)(n); ++i) #define REP(...) OVERRIDE(__VA_ARGS__, REP3, REP2)(__VA_ARGS__) #define PER2(i, n) for...
1973E
wrong_submission
medium
261,610,275
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 100005; int n, a[N]; void solve() { cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; int lef = n + 1, rig = 0, cnt = 0; for (int i = 1; i <= n; ++i) { if (a[i] != i) { lef = min(lef...
1973E
wrong_submission
medium
261,408,761
PyPy 3-64
WRONG_ANSWER on test 2
import sys import heapq input = sys.stdin.readline def fg(): return int(input()) def fgh(): return [int(xx) for xx in input().split()] def tt(): sys.stdout.flush() def sd(): print('Yes') def df(): print('No') for __ in range(fg()): n = fg() p = fgh() if p == sorted(p): print(2 * ...
1973E
wrong_submission
medium
261,667,347
PyPy 3-64
WRONG_ANSWER on test 2
import sys import os from io import BytesIO, IOBase from _collections import defaultdict # region fastio 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....
1973E
wrong_submission
medium
261,444,932
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve(){ int n; cin >> n; vector<int> q(n + 1); int mi = 1e9, ma = 0; for (int i = 1; i <= n; i++){ cin >> q[i]; if (q[i] != i) mi = min(mi, q[i]), ma = max(ma, q[i]); } if (ma < mi){ cout <<...
1973E
wrong_submission
medium
261,376,384
Java 21
TIME_LIMIT_EXCEEDED on test 3
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); int[] p = new int[n]; for (int i = 0; i < n; i++) {...
1973E
wrong_submission
medium
261,483,195
C++20 (GCC 13-64)
WRONG_ANSWER on test 4
#include <bits/stdc++.h> using namespace std; const bool local = false; vector<int> v; void solve() { int n, k; cin >> n; v.resize(n + 1); int L = n + 1; int R = 0; int cnt = 0; for (int i = 1; i <= n; ++i) { cin >> k; v[k] = i; if (i != k) { L = min(k, L); R = max(k, R); ...
1973E
wrong_submission
hard
262,348,610
C++14 (GCC 6-32)
WRONG_ANSWER on test 4
// LUOGU_RID: 160029361 //Man always remember love because of romance only! #include<bits/stdc++.h> using namespace std; inline int read(){ int n=0,w=0; char ch=0; while(!isdigit(ch)) {w|=ch=='-';ch=getchar();} while(isdigit(ch)) n=(n<<3)+(n<<1)+(ch^48),ch=getchar(); return w?-n:n; } inline void write(i...
1973E
wrong_submission
hard
261,448,935
C++17 (GCC 7-32)
WRONG_ANSWER on test 4
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e5 + 10; int n, a[N]; void mian() { cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; if (is_sorted(a + 1, a + n + 1)) return cout << 2 * n * (2 * n + 1) / 2 << '\n', void(); int v = -1; for (int i = 1; i <= n; i++) ...
1973E
wrong_submission
hard
265,420,163
C++14 (GCC 6-32)
WRONG_ANSWER on test 4
#include<bits/stdc++.h> #define MAXN 100005 using namespace std; int n; int a[MAXN]; void work(){ cin>>n; for(int i=1;n>=i;i++)cin>>a[i]; int mx=0,mn=1e9,ans=0,t=0,flg=0; for(int i=1;n>=i;i++) if(a[i]!=i)mx=max(mx,a[i]),mn=min(mn,a[i]),flg=1,t=a[i]+i; for(int i=1;n>=i;i++) if(a[i]!=i&&t!=a[i]+i)flg=-1; if(!fl...
1973E
wrong_submission
hard
261,436,423
C++17 (GCC 7-32)
WRONG_ANSWER on test 4
#include <bits/extc++.h> using namespace std; const int MAXN = 1e5 + 25; typedef long long ll; ll p[MAXN], n; bool vis[MAXN]; void solve () { cin >> n; for (int i = 1; i <= 2 * n; i++) { vis[i] = 0; } for (int i = 1; i <= n; i++) { cin >> p[i]; } ll cnt = 0; if (is_sorted(p + 1, p + n + 1)) { cout << 2 * n...
1973E
wrong_submission
hard
261,444,591
C++17 (GCC 7-32)
WRONG_ANSWER on test 4
#include <bits/stdc++.h> #define pb push_back #define lc (o<<1) #define rc (o<<1|1) #define Mid ((tr[o].l+tr[o].r)>>1) #define rint register int #define inv inline void #define ini inline int #define pair mypair using namespace std; typedef long long ll; struct pair{ ll x,y; bool operator == (const pair &u)const{ i...
1973E
wrong_submission
hard
278,774,854
C++20 (GCC 13-64)
OK
/** * author: tourist * created: 30.08.2024 07:31:34 **/ #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt; cin >> tt; while (tt--) { int n; cin >> n; ...
2006A
right_submission
none
278,780,780
C++20 (GCC 13-64)
OK
#include <bits/stdc++.h> using i64 = long long; void solve() { int n; std::cin >> n; std::vector<int> deg(n); for (int i = 1; i < n; i++) { int u, v; std::cin >> u >> v; u--; v--; deg[u]++; deg[v]++; } std::string s; std::cin >> s...
2006A
right_submission
none
282,779,835
Java 21
OK
import java.util.*; public class cf156 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int testCases = input.nextInt(); for (int t = 0; t < testCases; t++) { int nodes = input.nextInt(); int zeroLeafCount = 0, oneLeafCount = 0, u...
2006A
right_submission
none
280,567,361
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define ll long long #define fr(i, a, b) for (ll i = a; i < b; i++) #define mmst(i,a) memset(i,a,sizeof(i)) #define all(i) i.begin(),i.end() #define allr(i) i.rbegin(),i.rend() #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cou...
2006A
wrong_submission
easy
278,826,515
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; const int N=1e5+5; int tl,n;vector<int> to[N]; string s;int tp[N],wl,ans,anl,wx;bool vl; void get(int x,int f,int w){int tl; for(auto j:to[x]){ if(j==f)continue;tl=w; if(tp[x]&&!tp[j])tl--; else if(tp[j]&&!tp[x])tl++; get(j,x,tl); }if(x>1&&to[x].size()==1){ if...
2006A
wrong_submission
easy
282,109,857
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> #define pii pair<int,int> #define pll pair<long long,long long> #define lowbit(x) x&(-x) #define ls rt<<1 #define rs rt<<1|1 #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() // #define x first // #define y second using namespace std; using i64 = long long; using ll = long lo...
2006A
wrong_submission
easy
297,097,139
Java 21
WRONG_ANSWER on test 2
import java.util.*; import java.io.*; public class A_Iris_and_Game_on_the_Tree { int mod = (int) 1e9 + 7; static int a = 0; static int b = 0; static int c = 0; static int nl = 0; public static void main(String[] args) { int t = sc.nextInt(); while (t-- > 0) { ...
2006A
wrong_submission
easy
297,095,910
Java 21
WRONG_ANSWER on test 2
import java.util.*; import java.io.*; public class A_Iris_and_Game_on_the_Tree { int mod = (int) 1e9 + 7; static int a = 0; static int b = 0; static int c = 0; static int nl = 0; public static void main(String[] args) { int t = sc.nextInt(); while (t-- > 0) { ...
2006A
wrong_submission
easy
279,048,230
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; #define ll long long #define ss second #define ff first #define all(v) v.begin(),v.end() #define pb push_back #define display(a) { for (int i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<endl; } #define IOS {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);} #ifndef ONLINE_...
2006A
wrong_submission
easy
281,962,892
C++20 (GCC 13-64)
WRONG_ANSWER on test 2
#include <bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; vector<vector<int>> g(n); for(int i=1;i<n;i++){ int u,v; cin>>u>>v; u--,v--; g[u].push_back(v); g[v].push_back(u); } string s; cin>>s; if(s[0]!='?'){ int c...
2006A
wrong_submission
easy
278,799,719
C++17 (GCC 7-32)
WRONG_ANSWER on test 2
#include<bits/stdc++.h> using namespace std; int t,n,ans,tot; string s; vector<int> g[100100]; vector<int> rec; void dfs(int pos,int from){ bool isl=1; for(int i:g[pos]){ if(i==from) continue; isl=0; dfs(i,pos); } if(isl){ rec.push_back(pos); } else if(s[pos]=='?'&&pos!=1){ tot++; } return; } int main...
2006A
wrong_submission
easy
278,832,107
PyPy 3-64
WRONG_ANSWER on test 2
from sys import stdin,stdout input = stdin.readline from bisect import bisect,bisect_right,bisect_left from math import inf,ceil,log2,gcd,lcm,sqrt,log from heapq import heapify,heappop,heappush from collections import Counter,deque mod = 10**9 + 7 for _ in range(int(input())): n = int(input()) adj = [[] fo...
2006A
wrong_submission
medium
278,820,648
PyPy 3-64
WRONG_ANSWER on test 2
import os import sys from io import BytesIO, IOBase from collections import * from math import * from functools import * from types import * from heapq import * from itertools import * from operator import * from bisect import * BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): ...
2006A
wrong_submission
medium
281,909,979
Java 21
WRONG_ANSWER on test 2
import java.util.*; public class cf156 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for (int t = 0; t < T; t++) { int n = sc.nextInt(); int x = 0, y = 0, z = 0, w = 0; int[] deg = new int[n + 1];...
2006A
wrong_submission
medium
279,830,166
Java 8
WRONG_ANSWER on test 2
import java.io.*; import java.util.*; public class Main { boolean MULTI_CASE = true; boolean ALWAYS_FLUSH = false; void go() { int n = nextInt(); int[][] edges = inEdges(n - 1); d = edges2List(edges, n); a = next().toCharArray(); leafCnt = new int[200]; dive(0, -1); if (a[0] != '?') sl(l...
2006A
wrong_submission
medium
278,895,344
Java 21
WRONG_ANSWER on test 2
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class d { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = ...
2006A
wrong_submission
medium
278,894,398
Java 21
WRONG_ANSWER on test 2
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class d { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = ...
2006A
wrong_submission
medium
282,803,552
PyPy 3-64
WRONG_ANSWER on test 2
for _ in range(int(input())): n = int(input()) freq = [0]*n for i in range(n-1): u,v = map(int,input().split()) freq[u-1]+=1 freq[v-1]+=1 weight = list(input()) leafs = [i for i in range(1,n) if freq[i]==1] game = sum(weight[leaf]=='?' for leaf in leafs) if weight[0]!='?': score = sum(weight[leaf]!='?'...
2006A
wrong_submission
hard