source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <bits/stdc++.h> #define ll long long using namespace std; ll fp(ll a, ll b){ ll res=1; while(b){ if(b&1) res*=a; a*=a; b/=2; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll t; cin>>t; while(t--){ ll n...
C++
112a0cac4e1365c854bb651d3ee38df9
5eb4a72bfcbbfdff2565f8c93b4c0624
null
PASSED
#include <bits/stdc++.h> #define arr(i,n) for(int i=0;i<n;i++) #define ARR(i,n) for(int i=n-1;i>=0;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define F(i,a,b) for(int i=b-1;i>=a;i--) #define float double #define pb push_back #define mp make_pair #define debug(x) cout<<(#x)<<" is "<<(x)<<endl #define gcd(a,b) __gcd(a,...
C++
112a0cac4e1365c854bb651d3ee38df9
dfb5acab95918e3dd6e13b2acee8fc7c
null
PASSED
#include <bits/stdc++.h> #define arr(i,n) for(int i=0;i<n;i++) #define ARR(i,n) for(int i=n-1;i>=0;i--) #define f(i,a,b) for(int i=a;i<b;i++) #define F(i,a,b) for(int i=b-1;i>=a;i--) #define float double #define pb push_back #define mp make_pair #define debug(x) cout<<(#x)<<" is "<<(x)<<endl #define gcd(a,b) __gcd(a,...
C++
112a0cac4e1365c854bb651d3ee38df9
d5409a0522cc6f96897be318a799e2e6
null
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=200100; vector<long long>num[maxn]; long long check[maxn]; long long a[maxn]; long long n; int main() { cin>>n; cin>>a[1]; int flag=1; num[flag].push_back(a[1]); check[flag++]=a[1]; for(int i=2; i<=n; i++) { cin>>a[i]; ...
C++
ab9fde55578b8a46ad508fb91307f0d6
e99b9f9f513485b346b44479b5a820f7
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=2e5+10; int head[maxn],nxt[maxn],E[maxn],Ecnt; int f[maxn],fn; int a[maxn]; int tmp[maxn],num; int n; void Add_Edge(int x,int y) {nxt[++Ecnt]=head[x];head[x]=Ecnt;E[Ecnt]=y;} int main() { scanf("%d",&n); for (int i=1;i<=n;i++) scanf("%d",&a[i]); f[1]=a[...
C++
ab9fde55578b8a46ad508fb91307f0d6
748dbab487994258307c063e6c5fcb04
1,600
PASSED
#include<bits/stdc++.h> using namespace std; int a[200010], b[200010]; vector<int> p[200010]; int n, k; int main() { scanf("%d",&n); for (int i = 1; i <= n; i++) { scanf("%d",&a[i]); k = lower_bound(b + 1,b + 1 + n,a[i]) - b; k--; b[k] = a[i]; p[k].push_back(a[i]); ...
C++
ab9fde55578b8a46ad508fb91307f0d6
97c501d2ddfb9c3e1fa158c7fdce8682
1,600
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN=200000+10; int a[MAXN],n; vector<int> v[MAXN]; bool cmp(int x, int y) { return (a[x]<a[y]); } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); v[i].push_back(0); } for (int i=1;i<=n;i++) { ...
C++
ab9fde55578b8a46ad508fb91307f0d6
e4f1e6d862195515b858e74fc5c915ee
1,600
PASSED
//#pragma comment(linker,"/STACK:102400000,102400000") #include <iostream> #include <cstdio> #include <cstdlib> #include <cassert> #include <climits> #include <ctime> #include <numeric> #include <vector> #include <algorithm> #include <bitset> #include <cmath> #include <cstring> #include <iomanip> #include <complex> #in...
C++
ab9fde55578b8a46ad508fb91307f0d6
c12cf4a26d583f07c25786bd76a9240e
1,600
PASSED
#include <cstdio> #include <algorithm> #define R register using namespace std; int n,ans[200010],tot,next[200010],head[200010],tol,l[200010],l1,last[200010]; inline int read() { R char c=getchar();R int num=0; while (c<48||c>57) c=getchar(); while (c>47&&c<58) num=num*10+c-48,c=getchar(); return(num); } int m...
C++
ab9fde55578b8a46ad508fb91307f0d6
e05ff7ab6e77967d7eb91ec7a4cafa2e
1,600
PASSED
#include<cstdio> #include<algorithm> #include<cstring> using namespace std; int n; int a[400010]; int vis[400010]; int Next[400010]; int Max[2000000],num; void builine(int l,int r,int nu); void change(int l,int r,int nu,int x); int Find(int l,int r,int nu,int L,int R,int x); int main() { int i,j,k; scanf("%d",&n); f...
C++
ab9fde55578b8a46ad508fb91307f0d6
9c70776c85be10c0fc17a83b9d1d42da
1,600
PASSED
#include<bits/stdc++.h> using namespace std; const int N=200005; vector<int>mp[N]; int a[N]; template<class T> inline bool scan(T &ret) { char c; int sgn; if(c=getchar(),c==EOF) return 0; while(c!='-'&&(c<'0'||c>'9')) c=getchar(); sgn=(c=='-')?-1:1; ret=(c=='-')?0:(c-'0'); ...
C++
ab9fde55578b8a46ad508fb91307f0d6
af15bd5078c5d70de51474f84842c2dd
1,600
PASSED
#include <iostream> #include <fstream> #include <sstream> #include <algorithm> #include <cstdio> #include <cassert> #include <cmath> #include <cstdlib> #include <cstring> #include <string> #include <deque> #include <queue> #include <vector> #include <list> #include <map> #include <set> #include <bitset> #include <stack...
C++
ab9fde55578b8a46ad508fb91307f0d6
293e1d45b9f9170a9f1b83dd301803ca
1,600
PASSED
#include <queue> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cst...
C++
ab9fde55578b8a46ad508fb91307f0d6
8cfa0e0f7bf7b37a8c26ad8e7a620479
1,600
PASSED
#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> #include<cmath> #define ll int #define maxn 40010 using namespace std; int T,n,m,tmp=0; int a[1010]; char s[110][110],ans[100010]; int read() { int x=0,f=1; char c=getchar(); while(c>'9'||c<'0') { if(c=='-...
C++
554115bec46bb436a0a1ddf8c05a2d08
9c09a4ff635fdd7b84b47d6bb932f068
1,100
PASSED
//good luck # include <iostream> # include <cstdio> # include <cmath> # include <cstdlib> # include <cstring> # include <string> # include <algorithm> # include <vector> # include <queue> # include <ctime> # include <map> #define LL long long #define ULL unsigned long long #define maxn int(1e6+5) #define is(a) (a>='0'...
C++
554115bec46bb436a0a1ddf8c05a2d08
bc48aeda17958573bd33597b81ef8310
1,100
PASSED
//good luck # include <iostream> # include <cstdio> # include <cmath> # include <cstdlib> # include <cstring> # include <string> # include <algorithm> # include <vector> # include <queue> # include <ctime> # include <map> #define LL long long #define ULL unsigned long long #define maxn int(1e6+5) #define is(a) (a>='0'...
C++
554115bec46bb436a0a1ddf8c05a2d08
9e17ab4de03c9759d5e9b4df77d474fa
1,100
PASSED
#include <bits/stdc++.h> using namespace std; vector<string> contem; vector<string> ispalindrome; vector<bool> usando(300, false); int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); vector<string> strings; int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { string s; cin >> s; strings.push...
C++
554115bec46bb436a0a1ddf8c05a2d08
582e843d1d3e567db71de9098869029b
1,100
PASSED
/* be name Khoda */ // HW #include <bits/stdc++.h> using namespace std; const int N = 110; int n, m, match[N], pal = -1; string s[N]; vector<pair<int, int>> v; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> s[i]; match[i] = -1; } for (int i = 0; i < n; i++) { if (match[i] == -1) { rever...
C++
554115bec46bb436a0a1ddf8c05a2d08
f63a4cfbb3b7855aa66d2f284fc58d89
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f int m,n; char s[105][55]; int mp[105]; int res; int judge1(int a,int b) { int flag = 1; for(int i = 0;i < m;i++) { if(s[a][i] != s[b][m-i-1]) { flag = 0; break; } } if(flag) return 1; else return 0; } int judge2(int x) { for(int i...
C++
554115bec46bb436a0a1ddf8c05a2d08
9a8eb60a6c1bbfc3abd29d77ed8900bf
1,100
PASSED
#include<bits/stdc++.h> using namespace std; int main() {int n,m,k; cin>>n>>m; string t[n],s,pal,max=""; for(int i=0;i<n;i++) cin>>t[i]; for(int i=0;i<n;i++) { s=t[i]; reverse(s.begin(),s.end()); if(t[i]==s) { k=i+1; while((k<n)&&(t[k]!=s)) k++; if((k==n)&&((int)t[i].length()>=(int)max.length())) { ma...
C++
554115bec46bb436a0a1ddf8c05a2d08
21f8adbbc70d5aeec2326818281e7bd2
1,100
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 105; string s[N], t[N]; int n, m, used[N], p[N]; map<string, vector<int>>mp; int main() { ios::sync_with_stdio(false); cin >> n >> m; string ans = ""; for (int i = 1; i <= n; i++) { cin >> s[i]; for (int j = m - 1; j >= 0; j--) t[i] += s[i][j]; p[...
C++
554115bec46bb436a0a1ddf8c05a2d08
b8b98b6a8c1dd6318812f980d373286f
1,100
PASSED
#include<cmath> #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<vector> #include<set> #include<map> #include<numeric> #include<deque> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; vector<string> s(n); vector<string> k(n); vector<int> flag(n, 0);...
C++
554115bec46bb436a0a1ddf8c05a2d08
5f391ba6f86a17e706a0e5ddc1b2e1ed
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; string s[n]; for(int i=0;i<n;i++){ cin>>s[i]; } map<string,int> m1; for(int i=0;i<n;i++){ m1[s[i]]++; } int c=0; bool r=true; string ans=""; for(int i=0;i<n;i++){ string ...
C++
554115bec46bb436a0a1ddf8c05a2d08
dedd5d750e23d06a58be229c856e6def
1,100
PASSED
#include <bits/stdc++.h> #define For(i,a,b) for ( int i=(a);i<=(b);i++ ) #define Dow(i,a,b) for ( int i=(a);i>=(b);i-- ) #define int long long using namespace std; const int N=3e5+5; int n,m,x,y,ans,a[N],f[N],p[N]; signed main() { scanf("%lld%lld",&n,&m); For(i,1,n) scanf("%lld",&a[i]),p[a[i]]=i,f[i]=1; For(i,1,m...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
1e1935ec7373428f370f6603139da83d
1,800
PASSED
#include <bits/stdc++.h> #define For(i,a,b) for ( int i=(a);i<=(b);i++ ) #define Dow(i,a,b) for ( int i=(a);i>=(b);i-- ) #define int long long using namespace std; const int N=3e5+5; int n,m,x,y,ans,a[N],f[N],p[N]; signed main() { scanf("%lld%lld",&n,&m); For(i,1,n) scanf("%lld",&a[i]),p[a[i]]=i,f[i]=n; For(i,1,m...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
4bf389ba89322b08cd9dca1087441cdf
1,800
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; ll n,m,pos[300010],dp[300010],ans; signed main() { scanf("%lld%lld",&n,&m); for(ll i=1; i<=n; i++) { ll x; scanf("%lld",&x); pos[x]=i; dp[i]=n+1; } ans=1ll*n*(n-1)/2+n; while(m--) { ll u,v; ...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
85ed3e37779395520e56b4ba3dcd2ccc
1,800
PASSED
#include<bits/stdc++.h> #include<iostream> #include<string> #include<cmath> #include<cstdio> #include<cctype> #include<cstring> #include<iomanip> #include<cstdlib> #include<ctime> #include<set> #include<map> #include<utility> #include<queue> #include<vector> #include<stack> #include<sstream> #include<algorithm> using n...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
be84641445815d76333e6b394a25a6de
1,800
PASSED
#include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<vector> #include<stack> #include<queue> #include<cmath> #include<map> #include<set> #define ll long long #define ls l,m,rt<<1 #define rs m+1,r,rt<<1|1 #define ull unsigned long long #define pb push_back using name...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
c9d06ba6e5abc48fcab95f657312720f
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int N=300010; int n, m, a, b, pr[N], pos[N]; bool vis[N]; pair<int ,int>arr[N]; priority_queue< pair<int, int> > Q; priority_queue<int>Q2; long long res; int main() { //freopen("r.txt","r",stdin); scanf("%d %d",&n, &m); for(int i=0;i<n;i++){ scanf("%d",...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
4567ca8666760a6576672be508671ede
1,800
PASSED
#include<iostream> #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<stdlib.h> #include<queue> #include<stack> #include<map> #include<vector> #define mem(a) memset(a,0,sizeof(a)) using namespace std; __int64 p[300005]; __int64 num[300005]; __int64 x[300005],y[300005]; int main() { //fr...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
2f6299712c34c16d6add710e5ca81b17
1,800
PASSED
#include<iostream> #include<stdio.h> #include<string.h> #include<math.h> #include<algorithm> #include<stdlib.h> #include<queue> #include<stack> #include<map> #include<vector> #define mem(a) memset(a,0,sizeof(a)) using namespace std; __int64 p[300005]; __int64 num[300005]; __int64 x[300005],y[300005]; int main() { //fr...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
f82be9f35d27aa9560fc9aa4ed4914cc
1,800
PASSED
#include <iostream> using namespace std; long long n,m,i,x,y,p[300001],q[300001],a[300001],s; int main() { cin >> n >> m; for (i=1;i<=n;i++) { scanf("%ld",&p[i]); q[p[i]]=i; } for (i=1;i<=m;i++) { scanf("%ld%ld",&x,&y); if (q[y]>q[x]) a[y]=max(a[y],q[x]); else a[x]=max(a[x],q[y]); } x=1; for (i=1;i<=n;...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
9064708fe72fc1746cd2509193328d87
1,800
PASSED
#include <algorithm> #include <cstring> #include <iostream> #include <vector> using namespace std; const int cap = 3e5 + 1; int n, m; int pos[cap], L[cap]; int main() { cin >> n >> m; memset(L, 0, sizeof L); int p; for (int i = 1; i <= n; ++i) { cin >> p; pos[p] = i; } int a, ...
C++
0200c1ea8d7e429e7e9e6b5dc36e3093
1f7f90aa225836da3c0b5cf5d561c66f
1,800
PASSED
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf302218c { public static void main(String[] args) throws IOException { int n = rni(), m = ni(); List<Map<Integer, Integer>> g = new ArrayList<>(), ng = new ArrayList<>(); ...
Java
a65813fabe4110a3ee3d891f09302be1
e6125d163b712afacb1d9589a6df8b33
2,300
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <class T> using ordered_set = tree <T,null_type,less <T>,rb_tree_tag,tree_order_statistics_node_update> ; ///find_by_order() ///order_of_key() templa...
C++
a65813fabe4110a3ee3d891f09302be1
6a4795a4610c93c5fdfa093d00629483
2,300
PASSED
#include <bits/stdc++.h> using namespace std; //.define // #define FILE_IN_OUT #define RET(_x) return cout << (_x) << '\n', 0; #define all(_obj) std::begin(_obj), std::end(_obj) #define loop(_n) for (int i = 0; i < (_n); ++i) #define ceilDiv(_dividend, _di...
C++
a65813fabe4110a3ee3d891f09302be1
562f1146ee157fbd29e954ca23e7ac0e
2,300
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5+9; class UnionFind{ vector<int> p,rank,hasArtifact; public: UnionFind(int N): p(N+1),rank(N+1){ for(int i = 1; i <= N; i++) p[i] = i; } int findSet(int i){ if(p[i] == i) return i; else return p[i] = findSet(p[i]); } bool isS...
C++
a65813fabe4110a3ee3d891f09302be1
c366834d669564f7181957c375a9909d
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long #define INF LLONG_MAX #define _INF LLONG_MIN #define endl '\n' struct Grafo{ vector<vector<int>> adj, cost; vector<int> low, d, pai; vector<bool> vis, vtxValue; vector<pair<int, int>> bridges; vector<int> cost_bridge; int tempo = 0; map<pair<...
C++
a65813fabe4110a3ee3d891f09302be1
73f4ff654f88d6118539d53ca6a43dcb
2,300
PASSED
#include <bits/stdc++.h> #define int long long #define float long double using namespace std; void anime_sila_sport_mogila() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #ifdef _47 freopen("in.cpp", "r", stdin), freopen("out.cpp", "w", stdout); #endif } const int MAX_N = 3e5 + 47; int...
C++
a65813fabe4110a3ee3d891f09302be1
608b5adec1fa0684a11dc69eea906e70
2,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define oo 666666666 int n,m,tt=0; int artifacts[300005]; int disc[300005]; int low[300005]; int P[300005]; int visited[300005]; vector<array<int,2>>G[300005]; vector<array<int,2>>g[300005]; //bridge tree vector<array<int,3>>brid...
C++
a65813fabe4110a3ee3d891f09302be1
a4ef8d75249d27deba203ef002763d33
2,300
PASSED
// Daniel Grzegorzewski // while (clock()<=69*CLOCKS_PER_SEC) #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> // #pragma GCC target ("avx2") // #pragma GCC optimization ("O3") // #pragma GCC optimization ("unroll-loops") #define MP make_pair #define PB push_back ...
C++
a65813fabe4110a3ee3d891f09302be1
c2155306e5931ce341d51ca5e88de3da
2,300
PASSED
#include <bits/stdc++.h> using namespace std; mt19937_64 llrand(random_device{}()); #define st first #define nd second #define mp make_pair #define pb push_back #define cl(x, v) memset((x), (v), sizeof(x)) #define db(x) cerr << #x << " == " << x << endl #define dbs(x) cerr << x << endl #define _ << ", " << #define gc...
C++
a65813fabe4110a3ee3d891f09302be1
a4f6398d54e884b45415d90037a39b22
2,300
PASSED
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static PrintWriter pw = new PrintWriter(System.out); static class node { String s; int size; int rounds; int[] c1 = new int[26]; int[] c2 = new int[26]; int beauty; ...
Java
9b277feec7952947357b133a152fd599
ab1cdbaeebc9fbd3d59158d85b8fd0f6
1,800
PASSED
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Solution { public static int freq(String s){ HashMap<Character,Integer>h=new HashMap<>(); int m=1; for(int i=0;i<s.length();...
Java
9b277feec7952947357b133a152fd599
a0ae36f79527729e7d4fdf3c86dcdf5a
1,800
PASSED
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
9b277feec7952947357b133a152fd599
8008c51c5c13d706ed4823756b62887d
1,800
PASSED
import java.util.*; public class Main { static ArrayList<ArrayList<Integer>> tree = new ArrayList<>(); public static int size(int from, int exclude) { int size = 1; for (Integer v : tree.get(from)) { if (v != exclude) { size += size(v, from); } }...
Java
9b277feec7952947357b133a152fd599
79ac49d68c60f1be047fc46af1af8716
1,800
PASSED
import java.io.*; import java.util.*; public class B{ public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); int [] c=new int[125]; String x=sc.next(); int mx1=0; for(char s : x.toCharArray()) { c[...
Java
9b277feec7952947357b133a152fd599
e0b2c3aa576b37346783aee158700dcb
1,800
PASSED
import java.io.*; import java.util.*; public class d{ public static void main(String args[]) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader sc = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream...
Java
9b277feec7952947357b133a152fd599
0bdd577bc9817b2dd52ad1cde721f632
1,800
PASSED
import java.util.Scanner; public class TreasureHunt { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); String a = s.next(); String b = s.next(); String c = s.next(); int[] arr = new int[58]; int[] brr = new int[58]; ...
Java
9b277feec7952947357b133a152fd599
f26d406ebcabd1a43b5a2ccf5f289ca7
1,800
PASSED
import java.io.*; import java.util.*; public class Codeforces979B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(br.readLine()); int ...
Java
9b277feec7952947357b133a152fd599
1d03c8c8192e49f704a0e3c2e62758b5
1,800
PASSED
import java.util.*; public class Treasure{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] ribbons = new String[3]; for(int i = 0; i < 3; i++){ ribbons[i] = sc.next(); } int[...
Java
9b277feec7952947357b133a152fd599
6ae5b6e88609aa015f14532d6a957c4d
1,800
PASSED
import java.util.*; public class Treasure{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] ribbons = new String[3]; for(int i = 0; i < 3; i++){ ribbons[i] = sc.next(); } int[...
Java
9b277feec7952947357b133a152fd599
3deaaac96e409c77a893aa9a03edaa4b
1,800
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<string> #include<queue> #include<stack> #include<vector> #include<cstdlib> #include<map> #include<cmath> using namespace std; int n,m,k; int c[200010],tot[200010],maxn[200010],col[200010]; int fa[200010]; in...
C++
39232c03c033da238c5d1e20e9595d6d
1a1c2e69e984f0851808580e1c298835
1,600
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<string> #include<queue> #include<stack> #include<vector> #include<cstdlib> #include<map> #include<cmath> using namespace std; int fa[200050],tot[200010]={0}; int n,m,k; int col[200010]={0}; int res=0; vector<int> a...
C++
39232c03c033da238c5d1e20e9595d6d
dfb27a27ea660738931a18aadd0b0cdc
1,600
PASSED
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<string> #include<queue> #include<stack> #include<vector> #include<cstdlib> #include<map> #include<cmath> using namespace std; int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-'...
C++
39232c03c033da238c5d1e20e9595d6d
e995348f058b34bf12d31ac012f0b220
1,600
PASSED
using namespace std; #include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #i...
C++
39232c03c033da238c5d1e20e9595d6d
6d4073982de23e7905d9df6af83f36aa
1,600
PASSED
#include <bits/stdc++.h> #define max(a,b) a>b?a:b using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; vvi adjList; bool visited[200010] {false}; map<int,int> colors; vi socks; int nNodes = 0; int maxColor; void dfs(int index) { visited[index]=true; ++nNodes; ++colors[socks[index]]; ...
C++
39232c03c033da238c5d1e20e9595d6d
a676dda3e8a60d3dfdade12a99bb7abc
1,600
PASSED
#include <iostream> #include <string.h> #include <vector> #include <map> #define ll long long using namespace std; map <int,int> cur; vector <int> avail[200001]; bool color[200001]; int n, m, k, a[200001], i, c, b, v, ans = 0, visited, maxi; void visit(int u) { visited++; color[u] = 1; maxi = max(maxi, ++cu...
C++
39232c03c033da238c5d1e20e9595d6d
5b6a4c1474754c3a2099358c06e48282
1,600
PASSED
#include <iostream> #include <string.h> #include <vector> #include <map> #define ll long long using namespace std; map <int,int> cur; vector <int> avail[200001]; bool color[200001]; int n, m, k, a[200001], i, c, b, v, ans = 0, visited, maxi; void visit(int u) { visited++; color[u] = 1; maxi = max(maxi, ++cu...
C++
39232c03c033da238c5d1e20e9595d6d
9e5c0c1f4ab3df34444c1bb463e19db4
1,600
PASSED
#include "cstdio" #include "algorithm" #include "vector" #include "cstring" #include "map" using namespace std; int F[200010]; int c[200010]; int sum; int sum1; int maxx; vector<int> G[200010]; int coler[200010]; bool vis[200010]; bool vis1[200010]; bool cmp(int a,int b){ return a>b; } void DFS(int u){ // printf...
C++
39232c03c033da238c5d1e20e9595d6d
bfb6cbf8432ce48ac1c2d22455d7ade8
1,600
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn=233333; int a[maxn]; int f[maxn]; int n,m,k; int findfa(int x) { return f[x]==x?x:f[x]=findfa(f[x]); } void uni(int x,int y) { f[findfa(x)]=findfa(y); } vector <int> vis[maxn]; int cnt[maxn]; int main() { scanf("%d%d%d",&n,&m,&k); for(int i=1;i<=...
C++
39232c03c033da238c5d1e20e9595d6d
a1d958870251bf8cefd4b4e5b06c6114
1,600
PASSED
#include "cstdio" #include "algorithm" #include "vector" #include "cstring" #include "map" using namespace std; int F[200010]; int c[200010]; int sum; int sum1; int maxx; vector<int> G[200010]; map<int,int>Map; bool vis[200010]; bool cmp(int a,int b){ return a>b; } void DFS(int u){ // printf("%d\n",u); vis[u...
C++
39232c03c033da238c5d1e20e9595d6d
1f35e9e6b8336018991257673282785c
1,600
PASSED
t = int(input()) for _ in range(t): n, k = map(int, input().split()) w = list(map(int, input().split())) lst1 = [w[0], n - w[-1] + 1] lst2 = [(w[i + 1] - w[i]) // 2 + 1 for i in range(k - 1)] # 区間[a, b]に水やりするにはceil((b-a+1)/2)秒かかる。 # ceilを使わないように書いた。 print(max(lst1 + lst2))
Python
5de25068af66273c83cc7914910c4c84
25f0ce28b211dcb6f30d3a0eac0e8949
1,000
PASSED
for t in range(int(input())): [n,k]=[int(x) for x in input().split()] xi = [int(x) for x in input().split()] ans = max([xi[0],n-xi[-1]+1]+[(xi[i]-xi[i-1]+2)//2 for i in range(1,k)]) print(ans)
Python
5de25068af66273c83cc7914910c4c84
fe4497f91fc1bd5d751dc3b6b6056fa0
1,000
PASSED
t=int(input()) for i in range(t): [n,k] = [int(x) for x in input().split()] ans=1 xi = [int(x) for x in input().split()] ans=xi[0] for j in range(1,k): if(xi[j]-xi[j-1]+2)//2>ans: ans = (xi[j]-xi[j-1]+2)//2 if n - xi[k-1]+1>ans: ans=n-xi[k-1]+1 print(ans)
Python
5de25068af66273c83cc7914910c4c84
ae5318bbdeabc0e0e95bb4e38b90b3c5
1,000
PASSED
t = int(input()) # a = [0]*300 while t > 0: t -= 1 n, k = map(int, input().split()) a = list(map(int, input().split())) ans = 0 ans = max(a[0],n-a[-1]+1) l = len(a) for i in range(l-1): ans = max(int((a[i+1]-a[i])/2+1), ans) print(ans)
Python
5de25068af66273c83cc7914910c4c84
b60a28476f3cfc41446212c633a82a33
1,000
PASSED
for _ in range(int(input())): n,k=map(int,input().split()) l=list(map(int,input().split())) if len(l)==n: print(1) else: dp=[200]*(n+1) dp[0]=-1 for i in l: dp[i]=1 for i in range(1,n+1): if dp[i]==1: continue for j in l: dp[i]=min(ab...
Python
5de25068af66273c83cc7914910c4c84
b95c915b7735e599c474eeebb7ae97bf
1,000
PASSED
t = int(input()) for _ in range(t): n, k = map(int, input().split()) x = list(map(int, input().split())) ogorod = [0]*n sec = 0 while not all(ogorod): sec += 1 for xi in x: for j in range(1, sec): if xi-1 - j >= 0: ogorod[xi-1 - j] += 1 if xi-1 + j < n: ogorod[xi-1 + j] += 1 ogorod[xi...
Python
5de25068af66273c83cc7914910c4c84
97feed5721a6aff604d8217fe5c90e19
1,000
PASSED
import math t = int(input()) for i in range(t): n, k = map(int, input().split()) positions = list(map(int, input().split())) ans = max(positions[0], n - positions[-1] + 1) for j in range(1, k): ans = max(ans, math.ceil((positions[j] - positions[j - 1] + 1) / 2)) print(ans)
Python
5de25068af66273c83cc7914910c4c84
c8ffbdf39c35440544bb80bb8bf37614
1,000
PASSED
T = int(input()) for _ in range(T): n, k = map(int, input().split()) T = list(map(int, input().split())) l = -1 r = n while l < r - 1: i = (l + r) // 2 A = [0] * (n + 2) for t in T: A[max(t - i - 1, 0)] += 1 A[min(t + i, n)] -= 1 for j in range(1, n + 1): A[j] += A[j - 1] ...
Python
5de25068af66273c83cc7914910c4c84
46dcb0afa1cb92801e698ecfaf4abe96
1,000
PASSED
def get_tmax(n, k, Lk): t1 = Lk[0] tk = n - Lk[-1] + 1 tm = 0 for i in range(len(Lk) - 1): t = Lk[i + 1] - Lk[i] - 1 if t % 2: t = (t // 2) + 2 else: t = (t // 2) + 1 if tm < t: tm = t return max(t1, tk, tm) ans = [] ntest = int(in...
Python
5de25068af66273c83cc7914910c4c84
d12ec34c13ec7bd63b7ad65e7db67223
1,000
PASSED
def main(): for _ in range(int(input())): n, k = map(int, input().split()) a, *bb = map(int, input().split()) r = a * 2 - 1 for b in bb: if r < b - a: r = b - a a = b if r < (n - a) * 2 + 1: r = (n - a) * 2 + 1 print...
Python
5de25068af66273c83cc7914910c4c84
5e9b03820a65a528da44f466776eb93b
1,000
PASSED
#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 7; typedef long long ll; const int INF = 0x3f3f3f3f; int a[N],n; vector<char>ans; signed main() { ios::sync_with_stdio(0); int n; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; int l = 1, r = n, k = n, max...
C++
50c4b8fe3ab738e6e97058499791ac7b
3b400a90bb260a7c8bbaca95a8314044
1,300
PASSED
#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 7; typedef long long ll; const int INF = 0x3f3f3f3f; int a[N],n; vector<char>ans; int main() { int n; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; int l = 1, r = n, lst = 0; for(int i=1;i <=n && l <= r; ...
C++
50c4b8fe3ab738e6e97058499791ac7b
2ac3c4d0d8d1b49331ac77198f2b1a8c
1,300
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ss second #define ff first #define f(i,k,n) for(ll i=k;i<n;i++) #define E "\n" #define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL)) ll n,ans=0; string s; map<ll,ll> mp; int main() { FAST; cin>>n; ...
C++
50c4b8fe3ab738e6e97058499791ac7b
4d988cfd0f745bbf9ef2c99f37634cc3
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int a[200005]; int main(){ int n; string s; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int l=1,r=n; int t=0,ans=0; while(l<=r){ int u=a[l]>t; int v=a[r]>t; if(u&&v){ if(a[l]-t<a[r]-t){ ans++; s+='L'; t=a[l++]; } else{ ans...
C++
50c4b8fe3ab738e6e97058499791ac7b
c7ce6217c58f6d0796e1a7e9a2b7b671
1,300
PASSED
#include<bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll n; while (cin >> n) { string s = ""; ll a[200005]; for (ll i = 0; i < n; i++) { cin >> a[i]; } ll i = 0; ll j = n - 1; ll max = -1; if (a[i] < a[j]) { s += 'L'; max = a[i]; i++; } else { s += 'R'; ...
C++
50c4b8fe3ab738e6e97058499791ac7b
6b6ab436e81de0537125391974d7eb42
1,300
PASSED
#include<iostream> #include<string> using namespace std; long long input[2000000]; long long seq[2000000]; char output[2000000]; int main() { long long length,l,sublength=0,copyl=0; cin>>length; l=length; copyl=length; long long i=0,j=0,ks=0,ko=0,previous=0; for(i=0;i<length;i++) { cin>>input[i]; } i...
C++
50c4b8fe3ab738e6e97058499791ac7b
0232223f856b7ebb8c1e5645394fe74d
1,300
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e5 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; int arr[2*MAX]; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for(int i = 0;i < ...
C++
50c4b8fe3ab738e6e97058499791ac7b
1ce752737ca84c9e60b926872b29c4ca
1,300
PASSED
#include <bits/stdc++.h> #define pb push_back using namespace std; typedef long long ll; typedef unsigned long long ull; const int MAX = 1e5 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; int arr[2*MAX]; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for(int i = 0;i < ...
C++
50c4b8fe3ab738e6e97058499791ac7b
c3c8c71bf6f748d010e9b962daf16348
1,300
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,i,r,l,val=0; string s,ans; cin>>n; int a[n]; for(i=0; i<n; i++) cin>>a[i]; l=0;r=n-1; while(l<=r) { vector<pair<int,char> >v; if(val < a[l])v.push_back(make_pair(a[l],'L')); if(val < a[r...
C++
50c4b8fe3ab738e6e97058499791ac7b
080a12180c0f18cefff0661e1b11f764
1,300
PASSED
#include <iostream> #include <string> #include <vector> #include <cmath> #include <queue> #include <stack> #include <algorithm> #include <map> //#define ll long long //#define pb push_back //#define f first //#define s second //#define mp make_pair #define fi(i, a, b) for (int i = a; i < b; i++) //#define watch(x) cou...
C++
50c4b8fe3ab738e6e97058499791ac7b
22dabfe49daef36682c63cf07448185b
1,300
PASSED
#include<iostream> using namespace std; int main(){ int t; cin>>t; while(t--){ int x,n,m; cin>>x>>n>>m; while(x>=20&&n>0){ n--; x=x/2+10; } while(x>0&&m>0){ m--; x=x-10; } if(x<=0) cout<<"Yes"<<endl; else cout<<"No"<<endl; } }
C++
78f25e2bc4ff22dbac94f72af68a745f
0ac3c48d804aa97d280eced5f397d90f
900
PASSED
#include <iostream> using namespace std; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ int h,v,l; cin>>h>>v>>l; while((((h/2)+10)<=h)&&(v!=0)){ h/=2; h+=10; v--; }if((l*10)>=h){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } } }
C++
78f25e2bc4ff22dbac94f72af68a745f
28ec846b926a1d4e70e75dcb00729012
900
PASSED
#include<bits/stdc++.h> using namespace std; int t,x,n,m; int main(){ cin>>t; while(t--){ cin>>x>>n>>m; while(x>20&&n>0){ n--; x=x/2+10; } while(m--){ x-=10; } if(x>0)cout<<"NO"<<endl; else{cout<<"YES"<<endl;} } return 0; }
C++
78f25e2bc4ff22dbac94f72af68a745f
a60317bf06939ad40cf057a5eac23daa
900
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; int T; int x,n,m; int main() { scanf("%d",&T); while(T--) { scanf("%d%d%d",&x,&n,&m); for (int i=1;i<=n;i++) if (((x/2)+10)<x) x=((x/2)+10); x-=m*10; if (x<=0) printf("YES\n"); else printf("NO\n"); } r...
C++
78f25e2bc4ff22dbac94f72af68a745f
27a1eca9862af3236b0ee8c916389c0d
900
PASSED
#include<bits/stdc++.h> using namespace std; int hp,l,v,s; int main(){ cin>>hp; for(int i=1;i<=hp;i++){ cin>>l>>v>>s; while(l>20&&v>0){ l=(l>>1)+10; --v; }if(l<=s*10)puts("YES"); else puts("NO"); }return 0; }
C++
78f25e2bc4ff22dbac94f72af68a745f
8a6cce97f66110cfdc58733b4ce67407
900
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int x,n,m; cin>>x>>n>>m; while(n>0){ if(x<=20) break; x=x/2+10,n--; } while(m>0){ if(x<=0) break; x-=10,m--; } if(x<=0) cout<<"YES"; else cout<<"NO"; cout<<endl; } return 0; }
C++
78f25e2bc4ff22dbac94f72af68a745f
e2a10a170bc519072a43d08d1d9b6967
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int x,n,m; scanf("%d%d%d",&x,&n,&m); for(int i=0;i<n;i++) { if(x<=20)break; x=x/2+10; } if(x>10*m)cout<<"No"<<endl; else cout<<"Yes"<<endl; } }
C++
78f25e2bc4ff22dbac94f72af68a745f
0a178f0ad41f8a30fef99de77b7bb4ab
900
PASSED
#include <cstdio> int T, x, n, m; void input_calc_output() { // input scanf("%d", &T); for (int i = 1; i <= T; i++) { scanf("%d %d %d", &x, &n, &m); // calc while ((x/2+10)<=x && (n!=0)) { x = x/2+10; n--; } // output if (m*10 >= x) printf("YES\n"); else printf("NO\n"); } } int m...
C++
78f25e2bc4ff22dbac94f72af68a745f
5e9c3fcacc13406a9130c4e3fb3b2849
900
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int T; cin>>T; int x,n,m; for(int i=1;i<=T;i++) { cin>>x>>n>>m; while(n&&x>20) { x=x/2+10; n--; } if(x<=m*10) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
C++
78f25e2bc4ff22dbac94f72af68a745f
91a674bef0879c82f7ce224337fdd163
900
PASSED
#include<iostream> using namespace std; int main(){ int T; cin>>T; for(int i=0;i<T;i++){ int x,m,n; cin>>x>>n>>m; while(x>=20&&n!=0){ x=x/2+10; n--; } while(x>0 &&m!=0){ x=x-10; m--; } if(x>0) cout<<"NO"<<endl; else cout<<"YES"<<endl; } }
C++
78f25e2bc4ff22dbac94f72af68a745f
50f7003d00fa54c9953e2a6cd05a9d23
900
PASSED
a=int(input()) l=1 r=a ans=[1] while(len(ans)!=a): i=len(ans) if(i%2==1): ans.append(r) r-=1 else: ans.append(l+1) l+=1 print(*ans)
Python
02b7ff5e0b7f8cd074d9e76251c2725e
77b3e98e33aacef849b9c156edf1e376
1,200
PASSED
import time,math as mt,bisect as bs,sys from sys import stdin,stdout from collections import deque from fractions import Fraction from collections import Counter from collections import OrderedDict pi=3.14159265358979323846264338327950 def II(): # to take integer input return int(stdin.readline()) def IO(): # to ta...
Python
02b7ff5e0b7f8cd074d9e76251c2725e
0a522223f71afaeee9c3cd9c189874e5
1,200
PASSED
import sys from array import array # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') n = int(input()) if n == 1: print(1) exit() a = [1, n] ans = [1] while abs(a[0] - a[1]) > 0: ans.append(a[1]) if a[0] < a[1]: a[0] += 1 else: a[0] -= 1 a[0],...
Python
02b7ff5e0b7f8cd074d9e76251c2725e
8abe74fc51e2d89a1d5bec9a04450cd0
1,200
PASSED
n=int(input()) l=list(range(1,n+1)) a=[] start=0 end=len(l)-1 while(len(a)<len(l)): a.append(l[start]) a.append(l[end]) start=start+1 end=end-1 if(len(l)%2!=0): a=a[0:len(a)-1] print(*a)
Python
02b7ff5e0b7f8cd074d9e76251c2725e
11cd7530a7adf69ea79781c8a46b708c
1,200
PASSED
# import atexit # import io # import sys # # _INPUT_LINES = sys.stdin.read().splitlines() # input = iter(_INPUT_LINES).__next__ # _OUTPUT_BUFFER = io.StringIO() # sys.stdout = _OUTPUT_BUFFER # # # @atexit.register # def write(): # sys.__stdout__.write(_OUTPUT_BUFFER.getvalue()) n = int(input()) res = [] isLeft =...
Python
02b7ff5e0b7f8cd074d9e76251c2725e
a429b73f2d0b8ddfa20e349a5e257aa5
1,200
PASSED
from sys import stdin, setrecursionlimit, stdout setrecursionlimit(100) #use "python" instead of "pypy" to avoid MLE from collections import deque from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin from heapq import heapify, heappop, heappush, heapreplace, heappushpop from bisect import bisec...
Python
02b7ff5e0b7f8cd074d9e76251c2725e
13d2fecd35f92353d4dc3ea14b128584
1,200
PASSED
n = int(input()) for i in range(int(n/2)): print(i+1,n-i,end = " ") if n%2 != 0: print(int(n/2)+1)
Python
02b7ff5e0b7f8cd074d9e76251c2725e
9cd0cce580f9a08335e42afd81043b35
1,200
PASSED
from sys import stdin input = stdin.buffer.readline n = int(input()) k, c = (n + 1) >> 1, 0 while k + c > 0 and k + c <= n: print(k + c) k += c if c > 0: c += 1 else: c -= 1 c *= -1
Python
02b7ff5e0b7f8cd074d9e76251c2725e
a02a66cb7bdf2538b978c14e97369ee8
1,200
PASSED