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>
using namespace std;
long long t,x[2000],y[2000],n;
int main(){
scanf("%lld",&t);
while(t--){
scanf("%lld",&n);
for(int i = 1 ; i <= n ; ++ i)
scanf("%lld%lld",&x[i],&y[i]);
if(n % 2 != 0 || n == 1){
printf("1\n");
continue;
... | C++ | e0a1dc397838852957d0e15ec98d5efe | 2506622c9d28e598611f0716fab4609c | 1,500 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <vector>
#include <map>
#include <list>
#define SZ 1000005
#define ll long long
using namespace std;
int T,n;
ll x[1005],y[1005];
int main()
{
cin>>T;
while(T--)
{
cin>>n;
... | C++ | e0a1dc397838852957d0e15ec98d5efe | bcbc58beba8359b748d06d571c4bbffe | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<int> X, Y;
for(int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
X.push_back... | C++ | e0a1dc397838852957d0e15ec98d5efe | 77ffa791c975d023f8bd0e86c07d8d1f | 1,500 | PASSED |
# include <iostream>
# include <algorithm>
# include <iomanip>
using namespace std;
int main()
{
int t;
cin>>t;
for(int tc=0;tc<t;tc++)
{
int n;
cin>>n;
long double a[n],b[n];
for(int i=0;i<n;i++)
{
cin>>a[i]>>b[i];
}
... | C++ | e0a1dc397838852957d0e15ec98d5efe | e20e2156f086b59096040c201f39168e | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
void solve()
{
int n;
cin>>n;
vector<int> x(n),y(n);
for(int i=0;i<n;i++) cin>>x[i]>>y[i];
sort(x.begin(),x.end());
sort(y.begin(),y.end());
if(n&1) cout<<"1\n";
else cout<<1ll*(x[n/2]-x[n/2-1]+1)*(y[n/2... | C++ | e0a1dc397838852957d0e15ec98d5efe | b7d0d865bb87902049da1687f85f325d | 1,500 | PASSED |
//author: Ausp3x
//少壯不努力,老大徒傷悲。
#include <bits/stdc++.h>
typedef long long lng;
typedef unsigned int uint;
typedef unsigned long long ulng;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >>... | C++ | e0a1dc397838852957d0e15ec98d5efe | 30f11e1eb25e2c913a6e3ed9c86df295 | 1,500 | PASSED |
//author: Ausp3x
//少壯不努力,老大徒傷悲。
#include <bits/stdc++.h>
typedef long long lng;
typedef unsigned int uint;
typedef unsigned long long ulng;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >>... | C++ | e0a1dc397838852957d0e15ec98d5efe | a82e7cc850db12bbb44d1c536e33553e | 1,500 | PASSED |
//author: Ausp3x
//少壯不努力,老大徒傷悲。
#include <bits/stdc++.h>
typedef long long lng;
typedef unsigned int uint;
typedef unsigned long long ulng;
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >>... | C++ | e0a1dc397838852957d0e15ec98d5efe | 79f07d355fa9eb68145a2579b9d3d5cf | 1,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x[1005],y[1005];
int main()
{
ll n,t;
cin>>t;
while(t--)
{
cin>>n;
for(int i=1;i<=n;i++)
cin>>x[i]>>y[i];
if(n%2)
{
cout<<"1"<<endl;
continue;
}
sort(x+1,x+n+1);
sort(y+1,y+n+1);
ll ans=0;
ans=(x[n/... | C++ | e0a1dc397838852957d0e15ec98d5efe | c0eea5dfaf53c3f73d3c68bcdddc9e3e | 1,500 | PASSED |
#include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
#if DEBUG
freopen("input.txt", "r", stdin);
#endif
int n, k;
cin >> n >> k;
vector<int> A(n), sum(n + 1);
for (int i = 0... | C++ | dddeb7663c948515def967374f2b8812 | 34507b643d356b27a10b828ee0c66553 | 2,100 | PASSED |
#include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
#if DEBUG
freopen("input.txt", "r", stdin);
#endif
int n, k;
cin >> n >> k;
vector<int> A(n), sum(n + 1);
for (int i = 0... | C++ | dddeb7663c948515def967374f2b8812 | efb546b82fb24cae59526b6174be9d1f | 2,100 | PASSED |
#include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
#if DEBUG
freopen("input.txt", "r", stdin);
#endif
int n, k;
cin >> n >> k;
vector<int> A(n), sum(n + 1);
for (int i = 0... | C++ | dddeb7663c948515def967374f2b8812 | 606da5f69ab32228e312addbc0427463 | 2,100 | PASSED |
#include <iostream>
#include <vector>
#include <string>
#include <limits>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
#if DEBUG
freopen("input.txt", "r", stdin);
#endif
int n, k;
cin >> n >> k;
vector<int> A(n), sum(n + 1);
for (int i = 0... | C++ | dddeb7663c948515def967374f2b8812 | aecfadc846ba8323a3dbce86db3810d9 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
int a[N];
bool ok(int x, int n, int k)
{
vector <int> prf(n);
if (a[0] >= x) prf[0] = 1;
else prf[0] = -1;
for (int i = 1; i < n; i++){
prf[i] = prf[i - 1];
if (a[i] >= x) prf[i]++;
else prf[i]--;
}
int mx = prf[k - ... | C++ | dddeb7663c948515def967374f2b8812 | d8caad08c0ac7eeca6dcdc4be355c9ce | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
int a[N];
bool ok(int x, int n, int k)
{
vector <int> prf(n);
if (a[0] >= x) prf[0] = 1;
else prf[0] = -1;
for (int i = 1; i < n; i++){
prf[i] = prf[i - 1];
if (a[i] >= x) prf[i]++;
else prf[i]--;
}
int mx = prf[k - ... | C++ | dddeb7663c948515def967374f2b8812 | b972dc1b1c0c7eaee9a2b6754e11a3b6 | 2,100 | PASSED |
// LUOGU_RID: 90392360
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long LL;
const int N = 2e5 + 5;
int n, k;
int s[N];
int a[N], b[N];
bool Check(int m) {
for (int i = 1; i <= n; i++)
if (s[i] >= m) a[i] = a[i - 1] + 1;
else a[i] = a[i - 1] - 1;
for (int i = 1... | C++ | dddeb7663c948515def967374f2b8812 | 9040a2e3555b6046fa8d821b64b1c2da | 2,100 | PASSED |
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <strin... | C++ | dddeb7663c948515def967374f2b8812 | ac13cbd82fd13825203dfab42f3fa1f0 | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 9;
const int LOG = 20;
int a[N];
int b[N], pref[N], pref_min[N];
int n, k;
bool check_1(int x) { // does there exist a subarray with median at least x?
for (int i = 1; i <= n; i++) b[i] = (a[i] >= x ? 1 : -1), pref... | C++ | dddeb7663c948515def967374f2b8812 | c7269c042f15aafc83541bf41b3f050b | 2,100 | PASSED |
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
int n,k,a[200005],b[200005];
bool f(int mid)
{
for(int i=1;i<=n;i++)
{
if(a[i]>=mid)b[i]=1;
else b[i]=-1;
b[i]+=b[i-1];
}
int mn=0,mx=b[k];
for(int i=k;i<=n;i++)
{
... | C++ | dddeb7663c948515def967374f2b8812 | a3632e5e58d06f571f9ce20af10930a1 | 2,100 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define loop(i, a, b) for(ll i=a;i<b;i++)
#define pool(i, a, b) for(ll i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define lb lower_b... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 3438e336a364213f180bcbd072c5a3b4 | 2,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int kN = 3e5;
const int kLog = 18;
vector<int> g[1 + kN];
int level[1 + kN], lg2[1 + kN], anc[1 + kN][1 + kLog]; /// lca stuff
vector<pair<int, int>> down[1 + kN]; /// pentru fiecare lca de drum (u, v) tin perechi (stramos_U, stramos_V)
int up[1 + kN]; /// ... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | c0910c23aa8584ed942a6589fe5afb6b | 2,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int kN = 3e5;
const int kLog = 19;
vector<int> g[1 + kN];
int level[1 + kN], dp[1 + kN], anc[1 + kN][1 + kLog];
vector<pair<int, int>> down[1 + kN]; /// pentru fiecare lca de drum (u, v) tin perechi (stramos_U, stramos_V)
int up[1 + kN]; /// cate drumuri pl... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | b6224eab34fd29fdb05d5550ef1520b6 | 2,600 | PASSED |
#include <iostream>
#include <vector>
#include <set>
#include <cassert>
#include <map>
#define ll long long
using namespace std;
#define vec vector
struct path{
ll a, b;
ll r, sa, sb;
};
ll n, m;
vec<vec<ll>> ed;
vec<ll> d;
vec<pair<ll,ll>> dt;
vec<ll> anc[20];
vec<path> ps;
// full, sub
vec<pair<ll, ll>> ve... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 9109f59218a4a9175976621c3db6cd24 | 2,600 | PASSED |
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3", "omit-frame-pointer","inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
/***********************************************/
/* Dear online judge:
* I've rea... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 405214ff5d06b410562776fb1997fbc0 | 2,600 | PASSED |
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 0b19eab377e0f9b50ecde4c5fa5226d2 | 2,600 | PASSED |
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 3f4188e857fa7420e6ec3c7df0a6b6e4 | 2,600 | PASSED |
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 5928cf68148b588cafaba1cd29b55515 | 2,600 | PASSED |
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | 0c90d433638e13f123b2de9e9cec3879 | 2,600 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
int n,m,tot,sfg;
ll ans;
int dep[300009],f[300009][19];
int sz[300009],sn[300009];
vector<int> g... | C++ | 632afd3c714e4ab34fbc474f9f99d345 | dd7f016957e2a47accf7f5609d820867 | 2,600 | PASSED |
#include <queue>
#include <cmath>
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INTINF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
inline void file () {
freopen("test.in", "r", st... | C++ | abee4d188bb59d82fcf4579c7416a343 | e551e48be5d13d5650df236a5d06ab67 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll mod = 1e9 + 7;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const int N = 2e5*52;
int n,m,tot;
int d[N];
int v[N];
int fr,to; int va;
vector<P>g[N];
priority_queue< P > q;
void add(in... | C++ | abee4d188bb59d82fcf4579c7416a343 | ec792ad1bc47aa4d276a1f6bcc74bbe9 | 2,200 | PASSED |
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pre(i,a,b) for(int i=a;i>=b;i--)
#define N 5200005
using namespace std;
int n,m,s,h[N],tot;
struct edge{
int to,nxt,val;
}e[30000005];
void add(int x,int y,int z){
e[++tot].nxt=h[x];h[x]=tot;e[tot].to=y;e[tot].val=z;
}
priority_queue<... | C++ | abee4d188bb59d82fcf4579c7416a343 | c757f7bbb8a8c3a39f6d6f1a831eb76a | 2,200 | PASSED |
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define pre(i,a,b) for(int i=a;i>=b;i--)
#define N 5200005
using namespace std;
int n,m,s,h[N],tot;
struct edge{
int to,nxt,val;
}e[30000005];
void add(int x,int y,int z){
e[++tot].nxt=h[x];h[x]=tot;e[tot].to=y;e[tot].val=z;
}
priority_queue<... | C++ | abee4d188bb59d82fcf4579c7416a343 | df23934ee17b0cdeb2dd3ac63c456949 | 2,200 | PASSED |
#pragma GCC optimize("O3")
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstring>
#incl... | C++ | abee4d188bb59d82fcf4579c7416a343 | 6d0551a9868388e9b50d291cd9676808 | 2,200 | PASSED |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int _ = 1;
void _solve() {
int n, m;
cin>>n>>m;
vector< vector< pair<ll, ll> > > g(n);
for(int i = 0 ; i < m ; i++) {
int x , y, w;
cin>>x>>y>>w;
x--, y--;
g[x].push_back({y, w});
... | C++ | abee4d188bb59d82fcf4579c7416a343 | c8a04c35d458ee9dab828824d9355653 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/* * * * * * * * * * */
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
/* * * * * * * * * * */
/* *
*
* Too many mind, no mind.
*
* */
const int maxn = 1e5 + 10, maxw = 55, k = 51;
const ll oo = 1e1... | C++ | abee4d188bb59d82fcf4579c7416a343 | 6b0762956d4cd611a626a2d3c644f367 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/* * * * * * * * * * */
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<ll, int> pii;
/* * * * * * * * * * */
/* *
*
* Too many mind, no mind.
*
* */
const int maxn = 1e5 + 10;
const ll oo = 1e18;
ll dis[maxn], br... | C++ | abee4d188bb59d82fcf4579c7416a343 | 1c02157e7e9c38a89bb89c462234379a | 2,200 | PASSED |
#include<bits/stdc++.h>
#define MAXN 5100010
#define pii pair<int,int>
#define mp make_pair
#define idp first
#define wp second
int pf(int x){return((x)*(x));}
using namespace std;
int n,m,cnt,dis[MAXN+5];
bitset<MAXN+5>vis;
vector<vector<pii> >g;
void addE(int x,int y,int w){
g[x].push_back(mp(y,w));
}struct node{
i... | C++ | abee4d188bb59d82fcf4579c7416a343 | ae70b712a15e5eea6d21a2f553df2b10 | 2,200 | PASSED |
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <deque>
#include <queue>
#include <list>
#include <set>
#include <stack>
//#include <random>
#include <string>
#include <cmath>
#include <ctime>
#include <bitset>
#inc... | C++ | abee4d188bb59d82fcf4579c7416a343 | 9d953b425ab58c978a7864261dae01a3 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void go(vector<array<int,3>> &u, int &m, int res[], int Left[], int Right[]){
int L=u.size();
int x0, c0, ind0, x1, c1, ind1, d, i, j, ii, jj;
priority_queue<array<int,3>> q;
if(L<=1) return;
sort(u.begin(), u.end());
... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 6c590792c742517fd2529cfe7dec79a4 | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int arr[300005], Left[300005], Right[300005];
bool brr[300005];
void go(vector<array<int,3>> &u, int &m, int res[]){
int L=u.size();
int x0, c0, ind0, x1, c1, ind1, d, i, j, ii, jj;
priority_queue<array<int,3>> q;
if(L<=1) ... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 301f47620897b07d827ecb0fac2906a7 | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int Left[300005], Right[300005];
void go(vector<tuple<int,char,int>> &u, int &m, int res[]){
int L=u.size();
int x0, c0, ind0, x1, c1, ind1, d, i, j, ii, jj;
priority_queue<tuple<int,int,int>> q;
if(L<=1) return;
sort(u... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 50ef9753082e709dd6af7a7620664c4f | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int Left[300005], Right[300005];
int get(vector<pair<int,pair<int,char>>> &u, int i, int j, int &m){
int d = u[j].first - u[i].first;
if(u[i].second.second=='L') d += 2*u[i].first;
if(u[j].second.second=='R') d += 2*(m-u[j].first);
return d;
}
... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 701582b142890d712fe560cd2c0d4180 | 2,000 | PASSED |
// NOT MY CODE
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define pii pair<int,int>
#define mp make_pair
using namespace std;
int from[300005],back[300005];
void solve(){
int n,m;
scanf("%d %d",&n,&m);
int x[300005];
for(int i = 0;i<n;i++)scanf("%d",&x[i... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 8c2d7ef02616263f05bf3d5cbb67b0bc | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int res[300005];
int arr[300005], Left[300005], Right[300005];
bool brr[300005];
void go(vector<array<int,3>> &u, int &m){
int L=u.size();
int x0, c0, ind0, x1, c1, ind1, d, i, j, ii, jj;
priority_queue<array<int,3>> q;
if... | C++ | 1a28b972e77966453cd8239cc5c8f59a | a3bba64b0fd875ffdde1b539b18c859b | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int res[300005];
int arr[300005], Left[300005], Right[300005];
bool brr[300005];
void go(vector<array<int,3>> &u, int &m){
int L=u.size();
int x0, c0, ind0, x1, c1, ind1, d, i, j, ii, jj;
priority_queue<array<int,3>> q;
if... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 6698d88892ed9729a3187f4cdf09dbca | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define rep(i,j,k) for(ll i=j;i<k;i++)
#define en "\n"
#define N 10000010
template <typename T> ostream& operator<<(ostream& os, vector<T>& v) {
for(... | C++ | 1a28b972e77966453cd8239cc5c8f59a | d402867e03c9ca022dc80164158bfe13 | 2,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loopf(i,a,b) for(ll i=a;i<b;i++)
#define loopb(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define v... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 5ea5465c072629493049f15a5cd8c368 | 2,000 | PASSED |
#include <bits/stdc++.h>
// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) (long long)((a).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
template <typename T>
T modpow(T base, T exp, T modulus)
{
base %= modulus;
T result = 1;
... | C++ | 1a28b972e77966453cd8239cc5c8f59a | 53920b693ed3b690ce31f5c2ff185f25 | 2,000 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[20010];
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll flag=1;
for(ll i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]!=i)
flag=0;
}
if(flag==1)
{
cout<<0<<endl;
}
else if(a[1]==n&&a[n]==1)
{
cout<<3<<endl;
... | C++ | c212524cc1ad8e0332693e3cf644854b | 296055c2cd08a9344fe1839b51a087fc | 900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define mst(a) memset(a,0,sizeof(a))
#define PII pair<int,int>
#define over(i,s,t) for(int i=s;i<=t;i++)
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define PI 3.1415926535
const int INF = 0x3f3f3f3f;
const int m... | C++ | c212524cc1ad8e0332693e3cf644854b | 86b00d98ee5cabc5b17d85f202cb6c6c | 900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
vector<int> a(n);
for (int &x : a) scanf("%d", &x);
int ans = 2;
if (is_sorted(a.begin(), a.end()))
ans = 0;
else if (a[0] == 1 || a[n - 1] == n)
ans =... | C++ | c212524cc1ad8e0332693e3cf644854b | 0040a59131ac2726f721ee763d00af44 | 900 | PASSED |
/*
Author: Rudro_mozumdar
*/
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <random>
#define ll long long int
#define endl "\n"
#define filer freopen("in.txt", "r", stdin)
#define filew freopen("out.txt", "w", stdout)
#define test cout << "<>"
/... | C++ | c212524cc1ad8e0332693e3cf644854b | f20ba4093ffbda6d4ae98f4f1f254b9b | 900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include <debug.h>
#else
#define debug(...)
#endif
void solve() {
int n; cin >> n;
vector<int> vec(n + 1);
bool ok = 1;
for (int i = 1; i <= n; ++i) {
cin >> vec[i];
if (vec[i] != i) ok = 0;
}
if (ok) cout << "0\n";
else {
... | C++ | c212524cc1ad8e0332693e3cf644854b | 50862db9744e158598bf5b22a4f3a891 | 900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define rang(a) a.begin(), a.end()
#define pb(e) push_back(e)
#define mp(a,b) make_pair(a,b)
#define x first
#define y second
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ss... | C++ | c212524cc1ad8e0332693e3cf644854b | 9a26848e4e0c48a3477cb92f6f0174fb | 900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define ss se.se
#define fs fi.se
#define sf se.fi
#define all(x) x.begin(), x.end()
#define endl "\n"
typedef l... | C++ | c212524cc1ad8e0332693e3cf644854b | 1a3f0c2c4f9fb55040e0dda33afd09b0 | 900 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
bool cmp(long long a,long long b){return a>b;}
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
// freopen("input.in", "r", stdin);
// freopen("output.out", "w",... | C++ | c212524cc1ad8e0332693e3cf644854b | 6cdaba84506164c6a5420333bca7766a | 900 | PASSED |
//Bismillah Hir Rehmanir Rahim
//Allah knows best
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include ... | C++ | c212524cc1ad8e0332693e3cf644854b | 7b501ceb0495844b3dbe1e15cc691ed1 | 900 | PASSED |
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define deb(x) cout << #x << " " << x << endl;
#else
// online submission
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;... | C++ | c212524cc1ad8e0332693e3cf644854b | f61f6c65827b05114dbacfbaa52664eb | 900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int a[5010];
int b[5010];
int dp[5010][5010];
int main()
{
int n;
int cnt=1;
int cnt1=1;
int i,j,x;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>x;
if(x)
{
a[cnt++]=i;
}
else
{
b[cnt1++]=i;
}
}
for(i=0;i<=5005;i++)
... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 0ef6d89e674b2d1241ddd9b1a9256565 | 1,800 | PASSED |
/// Define GLOBAL
/// Don't forget special cases. (n = 1?)
/// Look for the constraints. (Runtime visay? overflow?)
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pii pair < int , int >
#define FAST ios::sync_with_stdio(0);cin... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | f0aadecd80997ecbbf30f221bb005298 | 1,800 | PASSED |
/// Define GLOBAL
/// Don't forget special cases. (n = 1?)
/// Look for the constraints. (Runtime visay? overflow?)
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pii pair < int , int >
#define FAST ios::sync_with_stdio(0);cin... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 8e22977d4c642083332979cc73e246a9 | 1,800 | PASSED |
/// Define GLOBAL
/// Don't forget special cases. (n = 1?)
/// Look for the constraints. (Runtime visay? overflow?)
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define pii pair < int , int >
#define FAST ios::sync_with_stdio(0);cin... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 314fb5be4d6186dc612ec1780761618f | 1,800 | PASSED |
// Problem: D. Armchairs
// Contest: Codeforces - Educational Codeforces Round 109 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1525/problem/D
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//author : mystic_ankush
#include <bits/std... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 642b72135b70e3d752b531dd7bb5383b | 1,800 | PASSED |
// Problem: D. Armchairs
// Contest: Codeforces - Educational Codeforces Round 109 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1525/problem/D
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// Powered by P Editor (https://github.com/cpeditor/cpeditor)
//author : mystic_ankush
#include <bits/stdc++... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | dbb9604a8e72c25390ec614ff1cc348e | 1,800 | PASSED |
// Problem: D. Armchairs
// Contest: Codeforces - Educational Codeforces Round 109 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1525/problem/D
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//author : mystic_ankush
#include <bits/stdc+... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 9035805245f0443ff429092d8053a4be | 1,800 | PASSED |
// Problem: D. Armchairs
// Contest: Codeforces - Educational Codeforces Round 109 (Rated for Div. 2)
// URL: https://codeforces.com/contest/1525/problem/D
// Memory Limit: 512 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//author : mystic_ankush
#include <bits/std... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 8829660da0049701098901fc20cdb4fd | 1,800 | PASSED |
#include "bits/stdc++.h"
using namespace std;
const int N=5010;
int a[N],b[N],f[N];
int main(){
int n,x1=0,x2=0,x;
scanf("%d",&n);
for (int i = 1; i <=n ; ++i) {
scanf("%d",&x);
if (x==1) a[++x1]=i;
else b[++x2]=i;
}
memset(f,0x3f,sizeof f);
f[0]=0;
for (int i = 1; i ... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 6514b48107c023d72911bb57adb04666 | 1,800 | PASSED |
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <unordered_set>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <stdio.h>
#include <stack>
#include <list>
#define ll long long
using namespace ... | C++ | ff5abd7dfd6234ddaf0ee7d24e02c404 | 862c1ab20546d9f7b9870dec8eb1d8ae | 1,800 | PASSED |
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<bitset>
#include<random>
#include<unordered_map>
#include<deque>
#include<cassert>
using namespace std;
#define re int
inline ... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | f75a5cd9774e208947e2fab4cae32641 | 2,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define double long dopuble
typedef pair<int, int> ii;
typedef long long ll;
const int ms = 200; // Quantidade maxima de vertices
const int me = 3000; // Quantidade maxima de arestas
int adj[ms], to[me], ant[me], wt[me], z;
int cop... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | 21756333f2ae83df748fa87938d0ce9f | 2,800 | PASSED |
//luogu
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define ok debug("ok\n")
const int N=105;
const bool Flag=1;
inline ll read() {
ll x(0),f(1);char c=getchar();
while(!isdigit(c)) {if(c=='-')f=-1;c=getchar();}
while(i... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | d6c12b44cd08a317add2debea4580a89 | 2,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned ll
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define ok debug("ok\n")
const int N=105;
const bool Flag=1;
inline ll read() {
ll x(0),f(1);char c=getchar();
while(!isdigit(c)) {if(c=='-')f=-1;c=getchar();}
wh... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | 81223ac708e9f0bbfa87e6b4b061ccc0 | 2,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for(int i = (int)(x); i < (int)(y); ++i)
#define REP(i, x, y) for(int i = (int)(x); i <= (int)(y); ++i)
#define MP make_pair
#define PB push_back
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef pair<int, i... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | 34ffd9e0173ca2f6a76d041d37e3f9c7 | 2,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
struct flow
{
static const int N=105,M=10005,inf=1000000000;
int n,m,s,t,h[N],to[M],f[M],nx[M],q[M],bg,ed,d[N],c[N];
void init()
{
m=1;
for(int i=1;i<=n;i++)
h[i]=0;
}
void addedge(int u,int v,int w)
{
m++;
f[m]=w,to[m]=v;
nx[m]=h[u];
h... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | 79484c940b7f41092a836eb99db3130d | 2,800 | PASSED |
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, ... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | d72a236cb661597612d293691b587f6d | 2,800 | PASSED |
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, ... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | da49bac237123be90760a0d627078ef9 | 2,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
namespace Ruri{
#define ms(a,b) memset(a,b,sizeof(a))
#define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ?
#define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i)
#define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].to)... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | c5c4482c9ebccd59956258e7953a15f2 | 2,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pr(x) cout<<#x<<": "<<x<<endl
const int N = 543;
const long long INF = (long long)(1e18);
struct Matching
{
int n1, n2;
vector<set<int>> g;
vector<int> mt, used;
void init()
{
mt = vector<int>(n2, -1);
}
... | C++ | 3ab4973d5b1c91fb76d5c918551ba9f7 | 78ec0afa314713ad860473409f56bd98 | 2,800 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
long long int p=998244353LL;
long long int modInverse(long long int a, long long int m)
{
long long int m0 = m;
long long int y = 0LL, x = 1LL;
if (m == 1LL)
return 0LL;
while (a > 1LL) {
// q is quotient
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | f95aee761ce4087cc03f301f689f8f3d | 2,100 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
long long int p=998244353LL;
long long int modInverse(long long int a, long long int m)
{
long long int m0 = m;
long long int y = 0LL, x = 1LL;
if (m == 1LL)
return 0LL;
while (a > 1LL) {
// q is quotient
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 616281c937e37966cf5217658e739ed9 | 2,100 | PASSED |
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | fff874049ac6a342ec8759e9c0de6bcd | 2,100 | PASSED |
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | f28122aadff17aea61e3f942c2d9a990 | 2,100 | PASSED |
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 7e11147b2735cfdc53c7fcaf6434ef2c | 2,100 | PASSED |
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod;
//Incase of close mle change language to c++17 or c++14
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 48917c9f995afd94af455e4fc7aa3782 | 2,100 | PASSED |
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 6b93f2b2a8de7803ddb159244f410b4f | 2,100 | PASSED |
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | d9b90b33413e89fdef741474b10083e0 | 2,100 | PASSED |
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 17adc7414f34e7816f42be1e68b56c11 | 2,100 | PASSED |
#include <functional>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <cstring>
#include <climits>
#include <cassert>
#include <complex>
#include <cstdio>
#include <string>
#include <vector>
#include <bitset>
#include <queue>
... | C++ | 81f709b914ca1821b254f07b2464fbf2 | 7d0011f4df1ef31bdde79a0ce909484f | 2,100 | PASSED |
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
// int m;
// cin>>m;
string s;
cin>>s;;
string ans;
int i=0,j=1,k=2;
while(i<s.length())
{
if(k<s... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 7bb8dbe1e5b74abbc930c0d3b664c728 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define f1i(n) for (int i=1;i<=n;i++)
#define f0i(n) for (int i=0;i<=n;i++)
#define flr(l,r) for(int i=l;i<=r;i++)
#define pb push_back
#define fi first
#define se second
#define ll long long
string s;
int n,t;
int main(){
ios_base::sync_with_stdio(0);cin.tie();c... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 47bf657deb49b3bcbc6401eefc0388eb | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s;cin>>s;
string ans;
char alph[27] = {' ','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 79c8e5af8525a4c9bd61de434740a35c | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int s[55];
char p[55];
int main(){
int n,a,cnt;
scanf("%d",&n);
while(n--){
cnt=0;
scanf("%d",&a);
for(int i=1;i<=a;i++){
scanf("%1d",&s[i]);
}
for(int i=a;i>=1;i--){
if(s[i]==0){ //这一位为0
p[++cnt]=s[i-2]*10+s[i-1]+'a'-1;
i-=2; //转换后要减
}
els... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 08468375bb3501075020c818224a8c27 | 800 | PASSED |
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
int t, n;
char ss[60];
int main(void) {
scanf("%d", &t);
while (t--) {
scanf("%d", &n);
scanf("%s", ss);
for (int i = 0; i < n; i++) {
if ((ss[i + 2] == '0' && i + 3 < n&&ss[i+3]!='0')||(ss[i + 2] == '0' && i + 2 == n-1)) {
int k = 0;... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 7ce578ddfea891ce00e5decbdeda925a | 800 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <unordered_map>
using namespace std;
const int N = 2010;
typedef long long LL;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
unordered_map<int, char> maps;
for (int i = 1; i <= 26; i++)
{
char c = 'a' + i - 1;
maps[i]... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | c36b935ef385378eefe647d65aa339b6 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string a;
cin>>a;
string ans;
for(int i=a.length()-1;i>=0;i--)
{
if(a[i]=='0')
{
int temp=a[i-1]-'0'+(a[i-2]-'0')*10;
ans+='a'+temp-1;
i-=2;
}
else
{
ans+='a'+a[i]-'0'-... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 9549c404f7761c0c8a9ff89e8fd918d0 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int q;
cin>>q;
while(q--)
{
int n;
cin>>n;
string a;
cin>>a;
string y;
for (int i=a.length()-1;i>=0;i--)
{
if(a[i]=='0')
{
int t=a[i-1]-'0'+(a[i-2]-'0')*10;
y+='a'+t-1;
i-=2;
}
else
{
y+='a'+a[i]-'0'-1;
}
}
... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | b0bc9985f6d4c519df289d7b3791c7f9 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
while (T--)
{
int n;
string st,str="";
cin>>n;
cin>>st;
for (int i=n-1; i>=0; i--)
{
if (st[i]=='0')
{
int x=(st[i-2]-'0')*10+(st[i-1]-'0');
char ch='a'+x-1;
str=ch+str;
i-=2;
}
else
{
int x=st[i... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 4af83124d25e4a4dd192ad53d1ce97f1 | 800 | PASSED |
#include <bits/stdc++.h>
const int N = 55;
int n;
char s[N];
int main() {
int T;
scanf("%d", &T);
while(T--) {
scanf("%d%s", &n, s + 1);
int i = 1;
while(i <= n - 3) {
if(s[i + 1] == '0' && s[i + 2] == '0') putchar('a' + 10 * (s[i] - '0') - 1), i += 3;
else ... | C++ | 43081557fe2fbac39dd9b72b137b8fb0 | 032b231d13c4865cdf8eb0d04b9a54da | 800 | PASSED |
#include<stdio.h>
int main()
{
int n,a,b,c,i;
scanf ("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d%d%d",&a,&b,&c);
if(a==1) printf("1\n");
else
{
if((b-c>=0)&& (a>b)) printf("2\n");
if((b-c<0)&&(2*c-b<a)) printf("2\n");
if((b-c<0)&&(2*c-b>a)) printf("1\n");
if((b-c>=0)&&(a... | C | aca2346553f9e7b6e944ca2c74bb0b3d | f735364018a904bc80788e13cc5fd315 | 800 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.