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 <iostream> using namespace std; int main() { int n, points; cin >> n >> points; int min(points), max(points), amazing(0); while (--n) { cin >> points; if (points < min) { min = points; ++amazing; } if (points > max) {...
C++
a61b96d4913b419f5715a53916c1ae93
6d769ec9f3d2a86cec770d54cf70fa61
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,cnt=0; cin >> n; int mn,mx; int arr[n]; for( int i=0;i<n;i++ ) { cin >> arr[i]; mn=arr[0]; mx=arr[0]; } for( int i=0;i<n;i++ ) { if( arr[i]<mn ) { mn=arr[i]; cnt++; } if( arr[i]>mx ) { mx=arr[i]; cnt++; } } cout<<cnt; }
C++
a61b96d4913b419f5715a53916c1ae93
efc8c35aedb3cda13f77507fd1093e25
800
PASSED
#include <iostream> using namespace std; #include <bits/stdc++.h> #include<cstring> #include<cmath> #include<cstdio> #include<string> #include<string.h> #include<stdio.h> #include <vector> #include <map> #define endl "\n" typedef long long ll; const int N = 1e9+7; int i,j,k; int main() { int n,a,a0,i0,cnt = 0; c...
C++
a61b96d4913b419f5715a53916c1ae93
d0d43d913170ae70b4c129a0b1189386
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int n,res1=0,min=100000,max=0,flag=0; cin>>n; int a[n]; for (int i=0;i<n;i++)cin>>a[i]; for (int i=1;i<n;i++) { if (a[i]>a[i-1]&&max<a[i]) { res1++; max=a[i]; if (min>a[i-1]) min=a[i-1]; } else{ if (a[i]<a[i-1]&&min>a[i]) { r...
C++
a61b96d4913b419f5715a53916c1ae93
6a56a7de79d31144ba8dce9a59f93a7a
800
PASSED
//Made by AtyrauKTL student : S.Saduakhas A.K.A BabyGroot #include <bits/stdc++.h> #define ktl the_best #define INF 1000000000000000000LL #define inf 2147483647 #define MOD 1000000007 #define pf push_front #define pb push_back #define fname "" using namespace std; long long n,mm = 9999,mx,a[100500],b[100500],i,ans; ...
C++
a61b96d4913b419f5715a53916c1ae93
cdc5f358527b82be36228cea2941b8ff
800
PASSED
#include<bits/stdc++.h> #include<stdio.h> #include<cmath> #include<cctype> using namespace std; #define pb push_back #define ll long long #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,ans=0; cin >> n; int a[n]; //int size = *(&a + 1) - a; for(int i=0;i<n;i++) { cin >>...
C++
a61b96d4913b419f5715a53916c1ae93
ff65b19d321d5388e4c067639f9249b3
800
PASSED
//╔═══━━━─── • ───━━━═══╗ // Agility //╚═══━━━─── • ───━━━═══╝ #include<bits/stdc++.h> #include<stdio.h> #include<cmath> #include<cctype> using namespace std; #define pb push_back #define ll long long #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,ans=0; cin >> n; in...
C++
a61b96d4913b419f5715a53916c1ae93
697e031529526739ce9711e0366d45df
800
PASSED
/* ╔═══━━━─── ◥◤ ───━━━═══╗ Agility ╚═══━━━─── ◢◣ ───━━━═══╝ */ #include<bits/stdc++.h> #include<stdio.h> #include<cmath> #include<cctype> using namespace std; #define pb push_back #define ll long long #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,ans=0; cin >> n; ...
C++
a61b96d4913b419f5715a53916c1ae93
2ec3c20339a8293b4b9180ded04ae1be
800
PASSED
/* ╔═══━━━─── ◥◤ ───━━━═══╗ Agility ╚═══━━━─── ◢◣ ───━━━═══╝ */ #include<bits/stdc++.h> #include<stdio.h> #include<cmath> #include<cctype> using namespace std; #define pb push_back #define ll long long #define nl "\n" int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n,ans=0; cin >> n; ...
C++
a61b96d4913b419f5715a53916c1ae93
9abe340ba05b164c9db673905ac33e5d
800
PASSED
#include <iostream> #include <map> #include <cmath> #include <set> #include <unordered_set> #include <unordered_map> #include <vector> #include <string> #include <algorithm> #include <queue> #include <iomanip> #define int long long using namespace std; vector<int>a; vector<bool>visited; int n , k; bool can(int s){...
C++
7324428d9e6d808f55ad4f3217046455
101130a1755e05b08599ad87bf8b93b6
1,400
PASSED
/** Author: Dwai * Omae wa mou shindeiru! **/ #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define eb emplace_back #define ff first #define ss second #define all(a) (a).begin(),(a).end() #define fr(i,a,b) for (i = a; i <= b; i++) #define frr(i,a,b) for (i = a; i >= b; i--)...
C++
7324428d9e6d808f55ad4f3217046455
e3bd4650db9b10a3ecd3e219e3326adc
1,400
PASSED
/** Author: Dwai * Omae wa mou shindeiru! **/ #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define eb emplace_back #define ff first #define ss second #define all(a) (a).begin(),(a).end() #define fr(i,a,b) for (i = a; i <= b; i++) #define frr(i,a,b) for (i = a; i >= b; i--)...
C++
7324428d9e6d808f55ad4f3217046455
efb2914ec60abadc172701628cfccb9b
1,400
PASSED
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <map> #include <fstream> #include <set> #include <stack> #include <queue> #include <list> using namespace std; typedef long long int64; typedef vector<int> vec; typedef vector<int64> vec64; #define db(x) cout << "> " << #x << ": " << x...
C++
7324428d9e6d808f55ad4f3217046455
0a8bac82621293eb8bf09f72ca123bae
1,400
PASSED
#include <bits/stdc++.h> #define endl "\n" using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; constexpr ll INF = 1e9 + 5; ll Contribution(ll w, vector<ll> &delt, vector<ll> &delt_pref){ ll l = 0, r = delt.size() - 1; ll ans = -1, mid = ...
C++
7324428d9e6d808f55ad4f3217046455
c5c5eda158399aa2623d339b23831d18
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long int n; cin>>n; long long int k; cin>>k; long long int arr[n]; for(long long int i=0;i<n;i++) { cin>>arr[i]; } long long int final[k]; long long int ctr=0; if(k<n) { for(long long int i=n-1;i>=n-k;i--) { final[ctr]=arr[i]; ctr++; }...
C++
7324428d9e6d808f55ad4f3217046455
b093ea3272ad2684202fecb4d9435258
1,400
PASSED
#include <bits/stdc++.h> using namespace std; #define int long long // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define fill fill_n #defin...
C++
7324428d9e6d808f55ad4f3217046455
2efbeb02debc1ef749cbbdd80ca8bb3e
1,400
PASSED
/* ID: mcbelgu1 TASK: gift1 LANG: C++14 */ #include<bits/stdc++.h> using namespace std; //using namespace __gnu_pbds; #define ll long long #define ff first #define ss second #define pb push_back #define freopen freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #define MOD 998244353 #define IOS ios_base:...
C++
7324428d9e6d808f55ad4f3217046455
2208a43d461b594659cdc3f27ecdadfc
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int fun(int s[],int n,int k,int mid){ int x=((2*k)-n),i=2*(k-x)-1; if(x==0) i=n-1; if(s[i]+s[(i-1)]<=mid) return 1; else { int sum=0; for(int l=0;l<=(k-x);l++){ sum = s[l]+s[i-l]; if(sum>mid) ...
C++
7324428d9e6d808f55ad4f3217046455
d64fd3117aa1bbdc31dfe8e42794cad9
1,400
PASSED
#include <bits/stdc++.h> using namespace std; const int MAXN = 100000; int N, K, S[MAXN], res; int main(){ cin >> N >> K; for(int i = 0; i < N; i++){ cin >> S[i]; res = max(res, S[i]); } for(int i = 0; i < N - K; i++){ res = max(res, S[i] + S[2 * (N - K) - 1 - i]); } cout << res << '\n'; }
C++
7324428d9e6d808f55ad4f3217046455
9648aa54d03ce28869f68b6b041e4ec2
1,400
PASSED
"""http://codeforces.com/problemset/problem/437/B""" def solve(s, limit): res = [] bit_length = len('{:b}'.format(limit)) # iterate through 2^x with x from 0, 1...bit_length-1 for i in range(bit_length - 1, -1, -1): low_bit = 2 ** i for j in range(1, limit + 1, 2): # odd number: 1, 3, ...
Python
1e4b638810ea9fa83c60a934ad49bf5e
3c8c80c600ecb9076c9ed60c77c45ad5
1,500
PASSED
a, b = map(int, input().split()) res = [] for i in range(b, 0, -1): k = i & (i ^ (i - 1)) if a >= k: res.append(str(i)) a -= k if a > 0: print(-1) else: print(len(res)) print(*res)
Python
1e4b638810ea9fa83c60a934ad49bf5e
257fccc9c732df7cec590f1cd31d565c
1,500
PASSED
s, l = map(int, input().split()) d = [list() for _ in range(l)] ans = list() for i in range(l): d[i] = [int('1' + '0' * bin(i + 1)[2:][::-1].index('1'), 2), i + 1] for v in reversed(sorted(d)): if v[0] <= s: s -= v[0] ans.append(str(v[1])) if s > 0: print(-1) else: print(len(ans)) ...
Python
1e4b638810ea9fa83c60a934ad49bf5e
f7f12c0b0cbda1b171c9b33e6c80803f
1,500
PASSED
while True: try: def solution(s, l ): ans = list() i = l idn= t = 1 while i >= 1: tr = i & t if tr > 0 and t <= s: s -= t ans.append(i) t, i= 1, i-1 elif tr > 0 and t > s: i -= 1 t = 1 else: t *= 2 if s == 0: break if s==0: print(len(a...
Python
1e4b638810ea9fa83c60a934ad49bf5e
284b92b2b35fe3ba8b54248db823f2e9
1,500
PASSED
'I could not solve this problem and I saw answer for this problem' 'see vice versa' Sum , limit = map(int,input().split()) res = [] choose = [] for i in range(1, limit + 1): choose.append((i & -i, i)) choose.sort() for i, j in choose[::-1]: if i <= Sum: Sum-=i res.append(j) if Sum: print("-1") else: print(len...
Python
1e4b638810ea9fa83c60a934ad49bf5e
3802dac3e8b3e9377228aa99517318af
1,500
PASSED
import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) ############ ---- Input Functions ---- ############ def in_int(): return (int(input())) def in_list(): return (list(map(int, input().split()))) def in_str(): s = input() return (list(s[:len(s) - 1])) def in_ints(): return (ma...
Python
1e4b638810ea9fa83c60a934ad49bf5e
33dca114bbcc454d5ad7c66528d90dc5
1,500
PASSED
s, l = map(int, input().split()) t = [] for i in range(l, 0, -1): k = i & (i ^ (i - 1)) if s >= k: t.append(str(i)) s -= k print(-1 if s else str(len(t)) + '\n' + ' '.join(t))
Python
1e4b638810ea9fa83c60a934ad49bf5e
aacbcb1f67db2bd8b3da5ee402cf7690
1,500
PASSED
(a, b), x, y = list(map(int, input().split())), [], 0 def bin(s): return str(s) if s <= 1 else bin(s >> 1) + str(s & 1) def lowbit(s): return int('1' + bin(s).split('1')[-1], 2) for i in reversed(range(b + 1)): if y == a: break if a >= y + lowbit(i): x.append(i) y += lowbit(i...
Python
1e4b638810ea9fa83c60a934ad49bf5e
3310b53d5fbf9c695fbb415e587a5f88
1,500
PASSED
s, l = map(int,input().split()) r=[] while (l>0 and s>0): if s-(l&l)>=0: s-=(l&-l) r.append(l) l-=1 if s!=0: print(-1) else: print(len(r)) print(*r)
Python
1e4b638810ea9fa83c60a934ad49bf5e
8349baa337db212782b49e2d592d6ad6
1,500
PASSED
s,l=map(int,input().split()) a=[] for i in range(l,0,-1): n=i&-i if n<=s: s=s-n a.append(i) if s==0: print(len(a)) for i in a: print(i,end=' ') else: print(-1)
Python
1e4b638810ea9fa83c60a934ad49bf5e
9bac214f24be5ff8ff22837b43994b2f
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define endl "\n" const int N=1e5+100; #define int long long #define double long double #define pb push_back #define vi vector<int> #define rep(i,n) for(int i=1;i<=n;i++) const double PI = 3.141592653589793238...
C++
c611808e636d9307e6df9ee0e706310b
d388fecaa5d6faf3d10e3d31089969ec
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int t,i,x,k=2,p,q,j; cin>>t; x=t*t; int a[x+1],b[x+1]; for(i=1;i<=x;i++) cin>>a[i]>>b[i]; //cout<<1<< " "; for(i=1;i<=x;i++) { p=a[i]; q=b[i]; if(p>0&&q>0) {cout<<i<< " "; for(j=i+1;j<=x;j++) ...
C++
c611808e636d9307e6df9ee0e706310b
0c5fd02968c8dbeabf8ab6d2e469d10a
1,000
PASSED
#include<bits/stdc++.h> #include<vector> using namespace std; int main() { int n,i,a,b,c[52]={0},d[52]={0}; vector<int> v; vector<int>:: iterator it; cin>>n; for(i=0;i<n*n;i++) { cin>>a>>b; if(c[a]==0 && d[b]==0) { c[a]=1; d[b]=1; v.push_back(i+1); } } for(it=v.begin();it!=v.end();it++) cout<<*it<<...
C++
c611808e636d9307e6df9ee0e706310b
898bcefe0dda8f79f0f94ce634e60d15
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int n,i=1,a,b,c[52],d[52]; main(){ for(cin>>n;i<=n*n;i++){ cin>>a>>b; if(!c[a]&&!d[b])cout<<i<<" ",c[a]=d[b]=1; } }
C++
c611808e636d9307e6df9ee0e706310b
c2bce0ca7e1313ea8fd79037c90c4361
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int n,i=1,a,b,c[52],d[52]; main(){ for(cin>>n;i<=n*n;i++){ cin>>a>>b; if(c[a]==0&&d[b]==0)cout<<i<<" ",c[a]=1,d[b]=1; } }
C++
c611808e636d9307e6df9ee0e706310b
c54ebddf5bc2813ad8d6c824c6dc34b3
1,000
PASSED
// In the name of Allah the Most Merciful. #include "bits/stdc++.h" #define ll long long #define PI 3.1415926535897932384626433832795l #define MAX_NUM 100000000000000 #define line cout << "------------------" << endl; using namespace std; ll SET(ll N, ll pos) { return N = N | (1 << pos); } ll RESET(ll N, ll pos) { retu...
C++
c611808e636d9307e6df9ee0e706310b
8e8ceee200bb09a1d2a00a5e327515f2
1,000
PASSED
#include<bits/stdc++.h> #define ll long long #define pb push_back #define pll pair<long long, long long> #define f first #define s second #define debug cout<<"here\n" #define MOD 1000000009 using namespace std; int A[51],B[51]; void solve(){ int n; cin>>n; for(int i=1; i<=n*n; i++){ int x,y; cin>>x>>y; if(A...
C++
c611808e636d9307e6df9ee0e706310b
48e027c32491d63b0965b2f2ad1aa89d
1,000
PASSED
#include<bits/stdc++.h> using namespace std; int arah[55],arav[55]; int main() { int n,i,j,k,h,v; cin>>n; vector<int>r; n=n*n; for(j=0;j<n;j++) { cin>>h>>v; if(arah[h-1]==0 && arav[v-1]==0) { r.push_back(j+1); arah[h-1]=1; arav[v-1]=1;...
C++
c611808e636d9307e6df9ee0e706310b
997f73272a089bf58eb5a2485cc3974c
1,000
PASSED
#include<iostream> #include<cmath> #include<vector> #include<string> #include<set> #include<algorithm> #include<map> #include<stack> #include<queue> #define SORT(A) sort(A.begin(), A.end()) #define vll vector <ll> using namespace std; typedef long long ll; typedef long double ld; int main() { ios_base::sync_...
C++
c611808e636d9307e6df9ee0e706310b
a684157b5ff4287787328233dc5e9861
1,000
PASSED
#include<bits/stdc++.h> using namespace std; /// File input & output ///// #define fRead(x) freopen("x.txt","r",stdin) #define fWrite(x) freopen ("x.txt","w",stdout) #define ld long double #define ll long long #define ull unsigned long long #define ff ...
C++
c611808e636d9307e6df9ee0e706310b
677e2b55dd5d9f167467bb7883d5fda3
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int xx, n; cin >> n; int l = 1e7, h = -1, last = -1, cnt = 0, ans = -1, rlast = 0; for (int i = 0; i < n; i++) { cin >> xx; if (l == 1e7) { cnt++; l = min(l, xx); } else if (h == -1 && xx != l) { cnt++; h = max(h, xx); if(l > h){ ...
C++
b784cebc7e50cc831fde480171b9eb84
6bd8deab7e33a8988d394b432d124bd2
1,400
PASSED
#include <cstdio> #include <iostream> using namespace std; int n,l,sum1,sum2,cnt1,cnt2,a[1000000],ans; int main() { scanf("%d",&n); scanf("%d",a+1); l=1,sum1=a[1],cnt1=1; for(int i=2;i<=n;++i) { scanf("%d",a+i); if(sum1==a[i]) ++cnt1; else if(sum2==a[i]) ++cnt2; else { while(cnt1&&cnt2...
C++
b784cebc7e50cc831fde480171b9eb84
860454c8c8b3deaa6130d9b47455f7b5
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int n,l,sum1,sum2,cnt1,cnt2,a[1000000],ans; int main() { cin>>n; cin>>a[1]; l=1,sum1=a[1],cnt1=1; for (int i=2;i<=n;i++) { cin>>a[i]; if (sum1==a[i]) cnt1++; else if (sum2==a[i]) cnt2++; else { ...
C++
b784cebc7e50cc831fde480171b9eb84
b31576d48cf78b812662e95e135910a8
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const int N=111111; inline int read() { int s=0; char c=getchar(); while (c<'0'||c>'9') c=getchar(); while (c>='0'&&c<='9') s=s*10+c-'0',c=getchar(); return s; } int main() { int ans=0,l=1,a[N],f[N],Min=0x7f7f7f7f,Max=0,n=read(); memset(f,0,size...
C++
b784cebc7e50cc831fde480171b9eb84
f852e22ef78361cea5ebf0616ead2250
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int n,l,sum1,sum2,cnt1,cnt2,a[1000000],ans; int main() { scanf("%d",&n); scanf("%d",&a[1]); l=1,sum1=a[1],cnt1=1; for (int i=2;i<=n;i++) { scanf("%d",&a[i]); if (sum1==a[i]) cnt1++; else if (sum2==a[i]) cnt2++; ...
C++
b784cebc7e50cc831fde480171b9eb84
f4ce68267363ef4ae4b9e0c025fbc729
1,400
PASSED
//#pragma GCC optimize(2) #include<set> #include<map> #include<cmath> #include<stack> #include<queue> #include<vector> #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> //#include<bits/stdc++.h> using namespace std; #define isNum(a) (a>='0'&&a<='9') #define SP putchar(' ') #def...
C++
b784cebc7e50cc831fde480171b9eb84
cbccb80b07dc5ac24396a1f615de9236
1,400
PASSED
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #define fr(i,a,b) for(int i=a;i<=b;i++) #define N 100010 using namespace std; int a[N]; int main(){ int n,m,now=1,ans=0; scanf("%d%d",&n,&a[1]); int sum1=1,sum2=0,id1=a[1],id2=0; fr(i,2,n){ scanf("%d",&a[i]); if(a[i]==id1)sum1++; else if(...
C++
b784cebc7e50cc831fde480171b9eb84
c8e5ebfedac92fb5142699dc3a81b3d1
1,400
PASSED
#include"bits/stdc++.h" using namespace std; inline int read() { int x=0,f=1; char c=getchar(); for(; !isdigit(c); c=getchar()) if(c=='-') f=-1; for(; isdigit(c); c=getchar()) x=x*10+c-'0'; return x*f; } int n; #define N 100001 int a[N]; #define INF 0x7ffffff int cnt=1; int opt,uxv; int len; int dis; in...
C++
b784cebc7e50cc831fde480171b9eb84
c52a013ac7c184875afe4fc1a85ff253
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int n,a[100001]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); int ans=0; for(int i=1;i<=n;i++) { if (n-ans<i) break; int maxn=a[i],minn=a[i]; int nowans=1; for(int j=i+1;j<=n;j++) { maxn=max(maxn,a[j]); minn=min(minn,a[j]); if...
C++
b784cebc7e50cc831fde480171b9eb84
a54aed4ca0ea0eb6ff02383508649f46
1,400
PASSED
#include<cstdio> #include<algorithm> using namespace std; int n,p,a,b,m,x,y,ans; struct node { int l,r,w,f,w1; }tree[400001]; inline void build(int k,int ll,int rr) { tree[k].l=ll,tree[k].r=rr; if(tree[k].l==tree[k].r) { scanf("%d",&tree[k].w); tree[k].w1=tree[k].w; return; ...
C++
b784cebc7e50cc831fde480171b9eb84
e8eab641a25e62fa3259b15dc92551bb
1,400
PASSED
#include <bits/stdc++.h> using namespace std; long long n,k; long long ans,last,x,sz; long long tree[6000001]; inline void update(long long x){ x+=sz-1; tree[x]++; x/=2; while (x>0){ tree[x]=tree[x+x]+tree[x+x+1]; x/=2; } } long long get(long long l,long long r,long long ll,long long...
C++
fc82362dbda74396ad6db0d95a0f7acc
e4297ee46181735c180ade9702d5c308
2,000
PASSED
#include <iostream> #include <vector> #include <map> #include <string> #include <set> #include <algorithm> #include <assert.h> #include <cstring> #include <queue> using namespace std; const int maxN = 1000001; int n, k; int tree[maxN * 4]; void build() { for (int i = 0; i < 4 * maxN; i++) { tree[i] = 0; } } i...
C++
fc82362dbda74396ad6db0d95a0f7acc
3eac09bf57f923191817d92ff973e9f7
2,000
PASSED
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> #include <utility> #include <algorithm> #include <iterator> #include <numeric> #include <string> #include <set> #include <map> using namespace std; #define forn(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define mp make_pair #de...
C++
fc82362dbda74396ad6db0d95a0f7acc
149a14888d3af62614a2bafc29049c13
2,000
PASSED
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> #include <utility> #include <algorithm> #include <iterator> #include <numeric> #include <string> #include <set> #include <map> using namespace std; #define forn(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define mp make_pair #de...
C++
fc82362dbda74396ad6db0d95a0f7acc
46689ae93e1f8187029a20a2931dfbe9
2,000
PASSED
#include <iostream> #include <vector> #include <map> #include <set> #include <algorithm> #include <string> using namespace std; class tree_t { public: tree_t( const int size ) { n = size; p = 1; while ( p < size ) p *= 2; t.resize( p + n, 0 ); } void inc( const int v ) { int id = p + v; while ( id...
C++
fc82362dbda74396ad6db0d95a0f7acc
2faafd49c443bc1078e203e52afae573
2,000
PASSED
#include <iostream> #include <vector> template<typename T> class SegmentTree { public: SegmentTree(T id, T (*op)(const T &, const T &), int size) : id(id), op(op), size(computeRealSize(size)), tree(2 * this->size, id) {} void update(int index, T newValue) { ...
C++
fc82362dbda74396ad6db0d95a0f7acc
28943d032617b404d32aa26349112f6c
2,000
PASSED
#include <iostream> #include <vector> template<typename T> class SegmentTree { public: SegmentTree(T id, T (*op)(T, T), int size) : id(id), op(op), size(computeRealSize(size)), tree(2 * this->size, id) {} void update(int index, T newValue) { if (tree[i...
C++
fc82362dbda74396ad6db0d95a0f7acc
6f898c460f33a97d6bcbcf3ea6550868
2,000
PASSED
#include <iostream> #include <vector> template<typename T> class SegmentTree { public: SegmentTree(T id, T (*op)(T, T), int size) : id(id), op(op), size(computeRealSize(size)), tree(2 * this->size, id) {} void update(int index, T newValue) { if (tree[i...
C++
fc82362dbda74396ad6db0d95a0f7acc
4620155d6382f18e4a610053bd21ed00
2,000
PASSED
#include <iostream> #include <vector> class SegmentTree { private: class Node { public: int l, r; int val; Node() : val(0) {} }; int max; std::vector<Node> tree; public: SegmentTree(int max = 1 << 20) : max(max), tree(max * 2) { for (int i = 2 * max - 1; i > ...
C++
fc82362dbda74396ad6db0d95a0f7acc
a446a6efa474a2f4dcdb04b0f6d6ecd6
2,000
PASSED
#include <iostream> #include <vector> template<typename T> class SegmentTree { public: SegmentTree(T id, T (*op)(T, T), int size) : id(id), op(op), size(computeRealSize(size)), tree(2 * this->size, id) {} void update(int i, T newValue) { for (i += size...
C++
fc82362dbda74396ad6db0d95a0f7acc
00de887258c962005443baf8d176876e
2,000
PASSED
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<algorithm> #include<utility> #include<map> #include<queue> #include<cmath> using namespace std; typedef long long ll; int main() { int t[1090][1090],k[1009]={0},h[1008]={0}; int n; cin>>n; int A=0; for(int i=0;i<n;i++) { for(int j=0...
C++
332902284154faeaf06d5d05455b7eb6
0cb36cdc5b59da9c12f8b7cca48ff205
1,600
PASSED
#include <bits/stdc++.h> #define ll long long int using namespace std; void hehe() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { int a; cin >> a; if (i == j) { arr[i]...
C++
332902284154faeaf06d5d05455b7eb6
19a5b8095529dfd7563760fff66807ef
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define sigma signed main #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL); #define test int t;cin>>t;while(t--) #define f(i,a,b) for(int...
C++
332902284154faeaf06d5d05455b7eb6
d2b3e0436edc8c942820421452baa6ca
1,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include "debug.h" #else #define db(...) 69 #endif const int N = 1e3; int n; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; vector<int> a(n+1); int sum = 0; for (int i = 0; i < n; i+...
C++
332902284154faeaf06d5d05455b7eb6
188dd09ade418540e9c3303b917d9ef9
1,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include "debug.h" #else #define db(...) 69 #endif const int N = 1e3; int n; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; int sum = 0; for (int i = 0; i < n; i++) { for (int j = 0; ...
C++
332902284154faeaf06d5d05455b7eb6
a48c5ec06adaf41097415fdfa52db209
1,600
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include "debug.h" #else #define db(...) 69 #endif const int N = 1e3; int n; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; vector<int> a(n+1); int sum = 0; for (int i = 0; i < n; i+...
C++
332902284154faeaf06d5d05455b7eb6
ccad1780df293a624918ce73c10d410d
1,600
PASSED
#include<iostream> #include<vector> #include<map> #include<string> #include<cstring>//memset() #include<algorithm> #include<sstream> #include<stack> #include<bitset> #include<queue> #include<cmath> #include<set> #define ll long long #define PI 3.14159265358979323846 #define IO ios::sync_with_stdio(0);cin.tie(NULL);cout...
C++
332902284154faeaf06d5d05455b7eb6
4329b9be2b0c22ba74da697365a42314
1,600
PASSED
#include<bits/stdc++.h> using namespace std; #define FastRead ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define ull unsigned long long #define SP(n) cout << setprecision(n) #define PI acos(-1....
C++
332902284154faeaf06d5d05455b7eb6
1407e7657298074879b421e21fddc99f
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define lli int #define vi vector<lli> #define str string #define ii pair<lli,lli> #define vii vector<ii> #define mp make_pair #define xx first #define yy second #define all(a) a.begin(),a.end() #define ins insert #define pb push_back //input/outp...
C++
332902284154faeaf06d5d05455b7eb6
88ebeb20ef4106b90d89cc6ec57a6ff5
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define lli long long int #define vi vector<lli> #define str string #define ii pair<lli,lli> #define vii vector<ii> #define mp make_pair #define xx first #define yy second #define all(a) a.begin(),a.end() #define ins insert #define pb push_back //...
C++
332902284154faeaf06d5d05455b7eb6
ceda0fed2b9e29271b18c5899889fbaf
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define Max(x,y,z) max(x,max(y,z)) #define Min(x,y,z) min(x,min(y,z)) #define pb push_back #define mp make_pair #define ff first #define ss second #define trace1(x) cerr<<#x<<": ...
C++
4a48b828e35efa065668703edc22bf9b
e363cc84ac6599a5f6477e8e388a1814
1,400
PASSED
#include <iostream> #include <limits> using namespace std; int main() { int n = 0; int fontSize[3001]; int costs[3001]; cin >> n; for (int i = 0; i < n; i++) { cin >> fontSize[i]; } for (int i = 0; i < n; i++) { cin >> costs[i]; } int minCost = INT_MAX; int cost = 0; for (int i = 1; i < n - 1; i++) { ...
C++
4a48b828e35efa065668703edc22bf9b
daaa77dbe40f302d3c8fd93a55eb55cd
1,400
PASSED
#include <iostream> using namespace std; int main() { int n; unsigned long long s[3000], c[3000]; unsigned long long f[3][3000]; cin >> n; for (int i = 0; i < n; i++) { cin >> s[i]; } for (int i = 0; i < n; i++) { cin >> c[i]; f[0][i] = c[i]; } for (int i = 1; i...
C++
4a48b828e35efa065668703edc22bf9b
00ed1f16650e9418b5df70aca521897a
1,400
PASSED
#include<cstdio> #include<iostream> using namespace std; struct node{ long long s,c; }a[3000+7]; long long dp[3000+7][4]; int main() { int n,i,j; cin>>n; for(i=1;i<=n;i++) cin>>a[i].s; for(i=1;i<=n;i++) cin>>a[i].c; // for(i=1;i<=n;i++) for(j=1;j<=3;j++) dp[i][j]=2147483647; for(i=2;i<=n;i++) {...
C++
4a48b828e35efa065668703edc22bf9b
3078e93f2d6c0b76985433d0c7177ebc
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main() { long long n,s[3010],c[3010],ans=1e10; cin>>n; for(int i=0; i<n; i++) cin>>s[i]; for(int i=0; i<n; i++) cin>>c[i]; for(int i=0; i<n; i++) { long long min1=1e10,min2=1e10; for(int j=...
C++
4a48b828e35efa065668703edc22bf9b
20449a2b1440e1fe642ce4505237f01b
1,400
PASSED
#include<bits/stdc++.h> using namespace std; const int maxn = 3010; int a[maxn],dp[maxn][4],n,s[maxn],c[maxn]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&s[i]); for(int i=1;i<=n;i++) scanf("%d",&c[i]); memset(dp,0,sizeof(dp)); int ans = 0x7fffffff; for(int i=1...
C++
4a48b828e35efa065668703edc22bf9b
b62b4aab76bcc94fb52d9c5dfc946b0a
1,400
PASSED
#include <bits/stdc++.h> #include <cstring> #define INF 0x3f3f3f3f #define MOD 1e9+7 using namespace std; struct node { int s,c; }arr[3005]; int pre[3005]; int til[3005]; int ans=INF; int main() { int n; scanf("%d",&n); memset(pre,INF,sizeof(pre)); memset(til,INF,sizeof(til)); for(int i=0;i<n;i...
C++
4a48b828e35efa065668703edc22bf9b
8f0d3264dd012c5cde5fb92d4a8cadfe
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long llt; const int MAXN = 100000; const llt INF = 0x0F0F0F0F0F0F0F0F; int N; int w[MAXN+1], c[MAXN+1], lisan[MAXN+1]; int L[MAXN*4+1], R[MAXN*4+1]; llt Min[MAXN*4+1]; llt dp[MAXN+1][4]; void init() { ...
C++
4a48b828e35efa065668703edc22bf9b
aaa5b36fba341069d5e8a44b9ee0c77e
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long llt; const int MAXN = 3000; const llt INF = 0x0F0F0F0F0F0F0F0F; int N; int s[MAXN+1], c[MAXN+1], lisan[MAXN+1]; int L[MAXN*4+1], R[MAXN*4+1]; llt Min[MAXN*4+1]; llt dp[MAXN+1][4]; void init() { me...
C++
4a48b828e35efa065668703edc22bf9b
07684e79e45d74964e4eb8cb95e531e4
1,400
PASSED
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int MAXN = 10000, MAXK = 50, INF = 0x3F3F3F3F; int N, K; int s[MAXN+1], c[MAXN+1]; int dp[MAXN+1][MAXK+1]; //dp[i][j] 表示走到 i 号公园时,已经走了 j 个公园 int L[MAXN*4+1], R[MAXN*4+1], Min[MAXN*4+1]; void init() { int l...
C++
4a48b828e35efa065668703edc22bf9b
bff7321e374f64696c706bd8ea63c959
1,400
PASSED
#include<bits/stdc++.h> using namespace std; #define maxn 2010 inline void MIN(int &a,int b){if(a>b)a=b;} inline void MAX(int &a,int b){if(a<b)a=b;} int n,m,q,sz; int f[maxn][maxn],u[maxn][maxn],lg[maxn],rg[maxn],qx[maxn],qy[maxn],ans[maxn]; char s[maxn][maxn]; struct line{ int f[maxn]; int find(int x){return f[x]==x...
C++
237e12fb3401ff63f12da40ebc502d9c
a9f54512c7db2d42311ecc0369d4f265
2,800
PASSED
#include<iostream> #include<fstream> #include<cstdio> #include<vector> #include<string> #include<cstring> #include<queue> #include<map> #include<set> #include<algorithm> #include<iomanip> #include<bitset> using namespace std; const int N = 2100; int n, m, kk, rez, px[N], py[N], rezz[N], up[N][N], down[N][N]; char a[N...
C++
237e12fb3401ff63f12da40ebc502d9c
f7a7e5c75cfba18d35bebcdc4b35de65
2,800
PASSED
#include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <utility> #include <bitset> #include <vector> #include <string> #include <stack> #include <queue> #include <ctime> #include <cmath> #include <list> #include <map> #include <set> using namespace std; typedef long lo...
C++
237e12fb3401ff63f12da40ebc502d9c
0b6900241aeaa0da7d83989bb86caba8
2,800
PASSED
#include <cstdio> #include <algorithm> #include <cassert> #include <vector> #include <set> #define fru(j,n) for(int j=1;j<=n;++j) #define tr(it,x) for(typeof(x.begin())it=x.begin();it!=x.end();++it) #define x first #define y second using namespace std; typedef pair<int,int> pii; const int MAXN = 2005; char S[MAXN][MA...
C++
237e12fb3401ff63f12da40ebc502d9c
f6ea4925f2acf801a41414c3a1d48d49
2,800
PASSED
#include <cstdio> #include <queue> #include <algorithm> #include <cassert> #include <vector> #include <set> #define fru(j,n) for(int j=1;j<=n;++j) #define tr(it,x) for(typeof(x.begin())it=x.begin();it!=x.end();++it) #define x first #define y second using namespace std; typedef pair<int,int> pii; const int MAXN = 2005;...
C++
237e12fb3401ff63f12da40ebc502d9c
fc98ba67df02791e6868e31a1afdba02
2,800
PASSED
#include <cstdio> #include <queue> #include <algorithm> #include <cassert> #include <vector> #include <set> #define fru(j,n) for(int j=1;j<=n;++j) #define tr(it,x) for(typeof(x.begin())it=x.begin();it!=x.end();++it) #define x first #define y second using namespace std; typedef pair<int,int> pii; const int MAXN = 2005;...
C++
237e12fb3401ff63f12da40ebc502d9c
3982640c0386ccf587ae9c01e9893122
2,800
PASSED
#include <cstdio> #include <algorithm> #include <vector> using namespace std; class tree { static const int offset = 1 << 11; short l[offset << 1]; short r[offset << 1]; short ans[offset << 1]; bool full[offset << 1]; public: void update(int x) { int left = x * 2, right = left + 1; f...
C++
237e12fb3401ff63f12da40ebc502d9c
54582c192f1fa086e71c7e2f6adfa974
2,800
PASSED
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=2e3+100; int n,m,k,modify; bool G[maxn][maxn]; int up[maxn][maxn],down[maxn][maxn]; int ans[maxn*4]; struct Stack{ int x,pos; Stack(){} Stack(int x,int pos): x(x),pos(pos){} bool operator < (const Stack& tmp)const { if (x...
C++
237e12fb3401ff63f12da40ebc502d9c
bcdb49c0abdb9e6808b9c726acf0ca61
2,800
PASSED
#include <cstdio> #include <cstdlib> #include <algorithm> #include <cstring> #include <cmath> #include <functional> #include <queue> #include <vector> #include <set> #include <map> #include <stack> #include <string> #include <ctime> #include <climits> using namespace std; #define LL long long #define X first #define Y...
C++
237e12fb3401ff63f12da40ebc502d9c
75198d9f728fa495988e8730110b0430
2,800
PASSED
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=2e3+10; int s[maxn][maxn]; int L[maxn][maxn],R[maxn][maxn]; bool G[maxn][maxn]; int curAns; int ans[maxn]; int x[maxn],y[maxn]; char ch[maxn]; int ll[maxn],rr[maxn]; int main() { int n,k,m; scanf("%d%d%d",&n,&m,&k); for (int i...
C++
237e12fb3401ff63f12da40ebc502d9c
5e0c8db3edc15374f50879c6a61a02ce
2,800
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <math.h> using namespace std; int n,m; void outdig(int i) { int k=0; while(k<n) { for(int j=0;j<pow(2.0,i);j++) { k++; if(k>n)return; cout<<k<<" "; } k+...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
e73339b005c184f79e8853e793102a22
1,600
PASSED
#include <iostream> #include <string> #include <algorithm> #include <fstream> #include <vector> using namespace std; ifstream fin ("input.txt"); ofstream fout ("output.txt"); #define cin fin #define cout fout vector <int> a[5001]; int main () { int n; cin >> n; for (int i = 1; i <= n; i++) a[0]...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
0577fdf3331df2b2c4a716ec020bde65
1,600
PASSED
#include <vector> #include <list> #include <map> #include <set> #include <queue> #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++
31a64a84b5cc4e27737eea2c14f6dbd7
ca5d887972aed8b331b7e60538301461
1,600
PASSED
#include <iostream> #include <algorithm> #include <fstream> #include <queue> #include <vector> #include <string> #include <map> #include <set> #include <math.h> #include <iomanip> using namespace std; #define rep(i,o,n) for (int i=o;i<=n;i++) #define rd cin >> #define w cout << #define wl cout << endl #define roa...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
0aec2dd6ee85c06f3719ef2040ee1191
1,600
PASSED
#include <fstream> using namespace std; int a[10][700]; int two_teams(int l, int r, int num) { int m = (l + r) / 2; for(int i = l; i <= m; i++) a[num][++a[num][0]] = i; if(r - l > 1) return max(two_teams(l, m, num + 1), two_teams(m + 1, r, num + 1)); return num; }; int main() { ifstream cin("input.txt"); of...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
20d485317895af564cfeaa0faf09cf59
1,600
PASSED
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <set> #include <map> #include <cmath> #include <cstdio> #include <cstring> #include <ctime> #include <ctime> using namespace std; typedef int i32; typedef long long i64; typedef unsigned u32; typedef unsigned long long u64; typedef lo...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
8510df2825d64e13b5b08cb82ff11767
1,600
PASSED
#include <algorithm> #include <functional> #include <numeric> #include <iostream> #include <iomanip> #include <sstream> #include <string> #include <vector> #include <queue> #include <stack> #include <cmath> #include <cassert> #include <bitset> #include <set> #include <map> using namespace std; // from mint.mint's so...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
bc53f99fdb40f40f3880941b6f1ed49f
1,600
PASSED
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <sstream> #include <utility> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <bitset> #include <algorithm> #include <cstdio> #include <cstdlib> #i...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
ab2ede529cf86e16900e0f64da3953f9
1,600
PASSED
#include <set> #include <map> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <cctype> #include <cstdio> #include <string> #include <vector> #include <cassert> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #define ll long lon...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
2008e3d4cd5ed414a24587bffd21b4e1
1,600
PASSED
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <ctype.h> #include <math.h> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <string> #include <iostream> #include <algorithm> using namespace std; #define ll __int64 #define ls rt<<1 #define rs ls|1 #define l...
C++
31a64a84b5cc4e27737eea2c14f6dbd7
43bcc12aa81dfe6ed2ee6c2613ce2f95
1,600
PASSED
// practice with rainboy import java.io.*; import java.util.*; public class CF707E extends PrintWriter { CF707E() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; int k, l; byte[] bb = new byte[1 << 15]; byte getc() { if (k >= l) { k = 0; try { ...
Java
a45f38aae8dadb6f0991b41ecb1be855
775862eefd11fbe05cb7d17d06372d8f
2,400
PASSED