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;
typedef long long ll;
typedef pair<int,int> pr;
const int mod=1e9+7,N=1000000;
int n,a[100005],mn[1000005],vst[1000005],fin[30],m,cho[100005],nd[1000005],b[30];
vector<int> pk[1000005];
vector<pr> fac[100005];
vector<vector<int>> ans;
int main(){
for(int i=2;i<=N;... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | f6082a533874cd9bbbed88c5067144b7 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
const int mod=1e9+7,N=1000000;
int n,a[100005],mn[1000005],vst[1000005],fin[30],m,cho[100005],nd[1000005],b[30];
vector<int> pk[1000005];
vector<pr> fac[100005];
vector<vector<int>> ans;
int main(){
for(int i=2;i<=N;... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 4f307fc028ba43937d8484ba3eed61a2 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
const int mod=1e9+7,N=1000000;
int n,a[100005],mn[1000005],vst[1000005],fin[30],m,cho[100005],nd[1000005],b[30];
vector<int> pk[1000005];
vector<pr> fac[100005];
vector<vector<int>> ans;
int main(){
for(int i=2;i<=N;... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 31ec7490c3dc23e9f600da593484690b | 3,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const int MAXN = 1010000;
vector<vector<int> > pfact(MAXN);
void init(){
for(int p = 2; p < MAXN; p++){
if(pfact[p].size() == 0){
for(int q = p; q < MAXN; q += p){
pfact[q].push_back(p);
}
}
}
}
// vector<int> gcds... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 880cd7ff64f9b2dc72b6d7981d281854 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int n,a[N],mx,p[N],pcnt,pd[N],mp[N],in[N],top,pos[N],mn[N],se[N],sub[N];
long long g=0;
pair<int,int> stk[N];
inline void init_prime(int n){
for(int i=2;i<=n;++i){
if(!pd[i]) p[++pcnt]=i,mp[i]=i,pos[i]=pcnt;
for(int j=1;j<=pcnt&&i*p[j]<=n;++... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | ebfb07de68655d6160978a0c5a2abfb6 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e5+5;
const int M=1e6+5;
bool vis[M];
vector<int>pr;
vector<pair<int,int>>fac[M];
void ysgs(int n) {
for (int i=2;i<=n;i++) {
if (!vis[i]) {
pr.emplace_back(i);
fac[i].emplace_back(i,1);
}
for (int j:pr) {
if... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | e0e9aa478b83156227b98e8b52095978 | 3,500 | PASSED |
#include<bits/stdc++.h>
namespace imzzy{
#define fi first
#define se second
#define rgi register int
#define endl '\n'
using std::cerr;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef std::pair<int,int> pii;
class fastin{public:int _ch,_f;
template<typename _T>inline ... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 6ee2fb38aff5fd185a94c2b489586e62 | 3,500 | PASSED |
#include<bits/stdc++.h>
namespace imzzy{
#define fi first
#define se second
#define rgi register int
#define endl '\n'
using std::cerr;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef std::pair<int,int> pii;
class fastin{public:int _ch,_f;
template<typenam... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 053653e83a3f9e5622d4728d6c8499f4 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int N=1e6+5,M=1e5+5;
int n,mx,T,pri[N],tot;bool flg[N];
void init(){
T=sqrt(mx);
for(int i=2;i<=mx;i++){
if(!flg[i])pri[++tot]=i;
for(int j=1;j<=tot&&pri[j]*i<=mx;j++){
flg[pri[j]*i]=1;
if(i%pri[j]==0)break;
}
}
}... | C++ | 265ea62fbb748b1b02ca31f4a6ddecda | 42b349f7891bfb1208a0b39927aef960 | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 661a9411c958655f9fabcd46231f4d77 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define Low(x) pow(2,(int)(log(x-0.1)/log(2))+1)
using namespace std;
typedef long long ll;
const int mod=998244353,N=250100,maxn=250001,o=3;
int mi(int x,int t){
int d=1;
while(t){
if(t%2) d=(ll)d*x%mod;
x=(ll)x*x%mod;t/=2;
}
return d;
}
int ni(int x) {return mi(x,mod-2)... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | fc0b9f744f72c11fa130181c65004d83 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> Poly;
const int N = 1 << 19, mod = 998244353;
int ksm(int a, int b){
int res = 1;
for(;b;b >>= 1, a = (LL)a * a % mod)
if(b & 1) res = (LL)res * a % mod;
return res;
}
int n, s, fac[N], ifac[N], inv[N], w[N];
int C(i... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 90aa11974dbbdf8e959823131183bf99 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> Poly;
const int N = 1 << 19, mod = 998244353;
int ksm(int a, int b){
int res = 1;
for(;b;b >>= 1, a = (LL)a * a % mod)
if(b & 1) res = (LL)res * a % mod;
return res;
}
int n, s, fac[N], ifac[N], inv[N], w[N];
int C(i... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 59ba1a7438706b92bcfa92620ade61fa | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 7284060ddc2520790f74239a6135503d | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 06ddb6fd020f9e65d299a238e8ceaf04 | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 5791d187f63b2c74ca48fb2d0db17e8d | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 1ea151ea7a0a6ef41f6790f09d2926f0 | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | 66be9e4380e9d41379c4edd7a43b6c17 | 3,500 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <chrono>
#include <random>
#include <functional>
#include <vector>
#define LOG(FMT...) fprintf(stderr, FMT)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int P = 998244353... | C++ | c73703c79ebe192c7ea5f76c9dfc277d | c065a87bc768d307cc7c1e5cf56538ab | 3,500 | PASSED |
// LUOGU_RID: 95171392
#include <cstdio>
#include <set>
#include <vector>
typedef unsigned int UI;
const int k=1e6,inf=1e9,N=2e5+10,M=1e6+10;
int n,x;std::multiset<int> set;
template<typename T>T lb(T x){return x&(-x);}
template<typename T>T rv(T x){return x>T()?x:-x;}
template<typename T>T min(T x,T y){return ... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 3c05f9815f7e8fc29508887bcf2c2712 | 3,500 | PASSED |
#include <cstdio>
#include <set>
#include <vector>
typedef unsigned int UI;
const int k=1e6,inf=1e9,N=2e5+10,M=1e6+10;
int n,x;std::multiset<int> set;
template<typename T>T lb(T x){return x&(-x);}
template<typename T>T rv(T x){return x>T()?x:-x;}
template<typename T>T min(T x,T y){return x<y?x:y;}
template<typ... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 702bdd705d5e4bef88a920a8f7a2e1f4 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 355f417089cdfff22870a80c09ac5c2e | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 3ca861da7fdb4a9373981f0ae8901659 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 6d116bedf2acdaffea24af3fb2bb3534 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 43429ec2bd5235fc9537a26059a32c2d | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | af3d4e3ee8dae03291ba5700462b5be6 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 6fb914934085c1f27e6945a1654be3c8 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 31b9302908f651e1fdd5745e0cb69fe9 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=2000005,E=1000001;
struct str{
int l;
long long x;
int d;
long long las(){return x+(l-1)*d;}
}a[N];
int ch[N][2],fa[N],h[N],tot,hc,ls[N],siz[N],i;
struct seg{
int l,r,x;
bool operator <(const seg &a)const
{
return a.r>r;
}
};
set<seg> p;
void pushup(int... | C++ | 1b6f6c60e66f7e09528a4c9b5389293b | 5df5150396d30d6ab2e18a59c3cf914d | 3,500 | PASSED |
//Code copied from Benq lol
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<bo... | C++ | fa02d096b1a8360764f5e68c24e8952f | 5f81731f6316382f9344a26703023501 | 3,500 | PASSED |
//Code copied from Benq lol
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<bo... | C++ | fa02d096b1a8360764f5e68c24e8952f | cfa402d03a11ace5afd6a50da40d54d8 | 3,500 | PASSED |
//Code copied from Benq lol //
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<... | C++ | fa02d096b1a8360764f5e68c24e8952f | 10c11983c568e43790ce7941b23e2602 | 3,500 | PASSED |
//Code copied from Benq lol
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<boo... | C++ | fa02d096b1a8360764f5e68c24e8952f | d79a9892980010329f24f38fe2b51d8c | 3,500 | PASSED |
//Code copied from Benq lol
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double; // or double, if TL is tight
using str = string; // yay python!
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;
using vi = vector<int>;
using vb = vector<boo... | C++ | fa02d096b1a8360764f5e68c24e8952f | c51751b0ab582ea035a84690fc0e99da | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define S 2250
int read(){
int w=0,f=1;
char c=' ';
while(c<'0'||c>'9')f=(c=='-'?-f:f),c=getchar();
while(c>='0'&&c<='9')w=w*10+c-'0',c=getchar();
return w*f;
}
int n,m,c[N],pre[N],nxt[N],pv[N],nv[N],a[N],bl[N],br[N],b[N... | C++ | fa02d096b1a8360764f5e68c24e8952f | 675fe7d6d40f8ab4180f1a566b649387 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Rg register
#define RI Rg int
#define Cn const
#define CI Cn int&
#define I inline
#define W while
#define N 200000
#define SM 224
#define LL long l... | C++ | fa02d096b1a8360764f5e68c24e8952f | 117a1bbfee2098ae9c02b1af55b4a42a | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define S 2250
int read(){
int w=0,f=1;
char c=' ';
while(c<'0'||c>'9')f=(c=='-'?-f:f),c=getchar();
while(c>='0'&&c<='9')w=w*10+c-'0',c=getchar();
return w*f;
}
int n,m,c[N],pre[N],nxt[N],pv[N],nv[N],a[N],bl[N],br[N],b[N... | C++ | fa02d096b1a8360764f5e68c24e8952f | 1a87c3754e44be6e1ab6f2c9829cf876 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define S 2250
int read(){
int w=0,f=1;
char c=' ';
while(c<'0'||c>'9')f=(c=='-'?-f:f),c=getchar();
while(c>='0'&&c<='9')w=w*10+c-'0',c=getchar();
return w*f;
}
int n,m,c[N],pre[N],nxt[N],pv[N],nv[N],a[N],bl[N],br[N],b[N... | C++ | fa02d096b1a8360764f5e68c24e8952f | a7803a8c7b4c50ac20fa65c563cec66b | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200005
#define S 2250
int read(){
int w=0,f=1;
char c=' ';
while(c<'0'||c>'9')f=(c=='-'?-f:f),c=getchar();
while(c>='0'&&c<='9')w=w*10+c-'0',c=getchar();
return w*f;
}
int n,m,c[N],pre[N],nxt[N],pv[N],nv[N],a[N],bl[N],br[N],b[N... | C++ | fa02d096b1a8360764f5e68c24e8952f | 7180273270a4bd685bf71101a364aff6 | 3,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int t,n,seg,op,aux=2;
char s[200100];
bool adapt = false;
int main() {
scanf("%d",&t);
while (t--) {
scanf("%d",&n);
memset(s,0,n+100);
scanf("%s",s);
aux = 2;
adapt = seg = op = 0;
for (int i=0;i<n;i+... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 48619aa26fee8e936b0284f199307b3d | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int t,n,seg,op,aux=2;
char s[200100];
bool adapt = false;
int main() {
scanf("%d",&t);
while (t--) {
scanf("%d",&n);
memset(s,0,n+100);
scanf("%s",s);
aux = 2;
adapt = seg = op = 0;
for (int i=0;i<n;i+... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | feffbecb276f01cf9702083739ec03e2 | 1,800 | PASSED |
//Author: Bit_8
#include<bits/stdc++.h>
using namespace std;
#define lowbit(a) a&(-a)
#define FAST() ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define NO {cout<<"NO"<<endl;return;}
#define YES {cout<<"YES"<<endl;return;}
#define No {cout<<"No"<<endl;return;}
#define Yes {cout<<"Yes"<<endl;return;}
#de... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 2b9946de079b57fc0bc9c801321a70f0 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
// Common memset settings
//memset(memo, -1, sizeof memo); // dp memoization with -1
//memset(arr, 0, sizeof arr); //cle... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 10a3f90d8829a7976984b2c73fd3e8c6 | 1,800 | PASSED |
#include<bits/stdc++.h>
#define mod2 998244353ll
#define mod1 1000000007ll
#define removezeros(s) s.erase(0,s.find("1")!=-1?s.find("1"):s.length()-1)
#define binary(n,k) bitset<k>(n).to_string()
#define makeset(s,c,sizeofc) for(int i = 0; i<sizeofc; i++){s.emplace_back(c[i]);while(i+1<sizeofc && c[i+1]==c[i])i++;}... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 6d80cb5290604169550d71e1ae087ba3 | 1,800 | PASSED |
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int t,n;
string s;
int main()
{
cin>>t;
while (t--)
{
cin>>n;
cin>>s;
int res = 0,cn = 0;
char last = ' ';
for (int i=0;i<n;i+=2)
{
if (s[i]!=s[i+1]) res ++;
... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 8565550b9fa02d5362d173c848cad930 | 1,800 | PASSED |
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define pi (3.141592653589)
#define ll long long
#define float ... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 4f1f2e36c2be9e60b48f903fd97a9791 | 1,800 | PASSED |
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double; //%Lf
using ui = unsigned int;
using ull = unsigned long long; //%llu
#define pn printf("\n")
#define void inline void
#define all(x) (... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | e7f93f4f2dbfec4c453ccecc885180ad | 1,800 | PASSED |
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double; //%Lf
using ui = unsigned int;
using ull = unsigned long long; //%llu
#define pn printf("\n")
#define void inline void
#define fcin ios... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 33d3900755602ec3169915d0b8d936e8 | 1,800 | PASSED |
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double; //%Lf
using ui = unsigned int;
using ull = unsigned long long; //%llu
#define pn printf("\n")
#define void inline void
#define all(x) (... | C++ | 8c7844673f2030371cbc0cb19ab99b35 | 814258825d1320e8cece57dab67d8bda | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
string str; cin >> str;
int ans = 0;
for(int i = 0; i<n; i+=2){
if(str[i] != str[i+1]){
ans++;
}
}
cout <... | C++ | aded139ff4d3f313f8e4d81559760f12 | 1bc3b040141ae80a8ad5526a9c6da2d9 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int test;cin>>test;
while(test--){
int n;cin>>n;
string s;cin>>s;
int ans =0,ones=0,zeros=0;
for (int i = 0;i<n;i++){
if (s[i] == '1')ones++;
else zeros++;
if (i%2==1){
if (one... | C++ | aded139ff4d3f313f8e4d81559760f12 | 2bf849df1d90a3100898c1e9db40e5e2 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int test;cin>>test;
while(test--){
int n;cin>>n;
string s;cin>>s;
long long answer = 0;
for (int i = 0;i<n;++i){
int j = i;
int counts = 0;
while(j<n && s[i]==s[j]){
counts++;
... | C++ | aded139ff4d3f313f8e4d81559760f12 | e9a7e262a543d6fd75eeb8222febb908 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
for (int i=0;i<a;i++)
{ int b;
cin>>b;
string c;
cin>>c;
int k=0,l=0,m=0;
for(int j=0;j<b-1;j++)
{ if (c[j]==c[j+1])
{
k=k+1;
}
else if (k%2==1)
{
k=0;... | C++ | aded139ff4d3f313f8e4d81559760f12 | 8e0369f78b24d58ce09eddde51686d5d | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10;
int t,n;
string s;
int main()
{
ios::sync_with_stdio(false);
cin>>t;
while(t--)
{
cin>>n;
int ans=0,cnt=0;
cin>>s;
char k='p';
for(int i=0;i<n;i+=2)
{
if(s[i]!=s[i+1])
{
ans++;
s... | C++ | aded139ff4d3f313f8e4d81559760f12 | 6cd03f3c924ef338db5d093357d8ecff | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1e6+1;
int T,n,num;
char s[MAXN];
struct node
{
int num,k;
}a[MAXN];
int main()
{
cin>>T;
while(T--)
{
cin>>n;
scanf("%s",s+1);
num=0;
char pre=s[1];
int cnt=0;
for(int i=1;i<=n;i++)
{
if(s[i]!=pre)
{
a[++num]... | C++ | aded139ff4d3f313f8e4d81559760f12 | 3d959830d48b4b1e4a7b964d4461bf01 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long LL ;
typedef pair<int,int> PII ;
const int N = 200010;
int a[N];
int n ;
string s ;
void solv(){
cin >> n ;
cin >> s ;
for(int i = 0 ; i < n ; i ++ ) a[i] = s[i]-'0';
int ans = 0 ;
int cur = a[0], cnt = 1 ;
for(int i = 1 ; i < n ; i ... | C++ | aded139ff4d3f313f8e4d81559760f12 | 0ca78f11e309424835d6d3c8f1c251f3 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int t,n;
string s;
int main()
{
ios::sync_with_stdio(false);
cin>>t;
while(t--)
{
cin>>n;
cin>>s;
int cnt0=0,cnt1=0;
bool flag;
int ans=0;
if(s[0]=='0')
flag=0;
else
flag=1;
for(int i=0;i<n;i++)
{
i... | C++ | aded139ff4d3f313f8e4d81559760f12 | 55f4bf25df9db11f5292783377214882 | 800 | PASSED |
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
#include <string>
//#include<unordered_set>
#define ll long long int
#define fi first
#define se second
#define m_p make_pair
#define endl '\n'
#define fast_io \
ios_base::sync_with_stdio(0); \
cin.tie(0)
#de... | C++ | aded139ff4d3f313f8e4d81559760f12 | a47146da8511ab9c63d37fa074387dc4 | 800 | PASSED |
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
for (int test = 0; test < t; ++test)
{
int n;
string s;
cin >> n >> s;
char prev = s[0];
int currentCount = 0, res = 0;
for (int i = 0; i < n; ++i)
{
... | C++ | aded139ff4d3f313f8e4d81559760f12 | 291aca4c9eb3fd92a87958bb85cc1f3f | 800 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeForces
{
internal class Program
{
static void Main(string[] args)
{
int tests = Convert.ToInt32(Console.ReadLine());
List<int> r... | C# | ad242f98f1c8eb8d30789ec672fc95a0 | 72c8bff7e417e47d243608b3d6471e56 | 800 | PASSED |
// Problem: 1678A - Tokitsukaze and All Zero Sequence
// Author: Gusztav Szmolik
using System;
using System.Collections.Generic;
using System.Text;
public class TokitsukazeAndAllZeroSequence {
public static void Main () {
StringBuilder ans = new StringBuilder ();
short t = short.Pa... | C# | ad242f98f1c8eb8d30789ec672fc95a0 | 78da8d765b41d1f7f729ef69fb8ef244 | 800 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeForces
{
internal class Program
{
static void Main(string[] args)
{
int tests = Convert.ToInt32(Console.ReadLine());
List<int> r... | C# | ad242f98f1c8eb8d30789ec672fc95a0 | 34a1ae0ce1219f006fc6f91c36c73c47 | 800 | PASSED |
using System;
using System.Linq;
using System.Collections.Generic;
namespace c789_a
{
class MainClass
{
public static void Main(string[] args)
{
var tstsr = Console.ReadLine().Trim();
var m = Int32.Parse(tstsr);
for (int i = 0; i < m; i++)
... | C# | ad242f98f1c8eb8d30789ec672fc95a0 | d2c221eef348cacfba6562dbbe1b4ab7 | 800 | PASSED |
using System;
using System.Collections.Generic;
using System.Linq;
namespace Compete2
{
partial class MainClass
{
public static void Main(string[] args)
{
int count = int.Parse(Console.ReadLine());
List<string> output = new List<string>();
for (int z = 0; z... | C# | ad242f98f1c8eb8d30789ec672fc95a0 | 843e0d2215ffbe2d79ec4a3c73a099dc | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) begin(x), end(x)
#define T ll t ; cin >> t; while(t--)
#define ll long long
#define For(base,until) for (ll (i) = (base); i < (until); ++i)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int M=1e5;
int main... | C++ | ad242f98f1c8eb8d30789ec672fc95a0 | 87a782233c7231c51866a8d97e69e399 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) begin(x), end(x)
#define T ll t ; cin >> t; while(t--)
#define ll long long
#define For(base,until) for (ll (i) = (base); i < (until); ++i)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int M=1e5;
int main... | C++ | ad242f98f1c8eb8d30789ec672fc95a0 | afa02db200d320905beab713f86192c5 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) begin(x), end(x)
#define T ll t ; cin >> t; while(t--)
#define ll long long
#define For(base,until) for (ll (i) = (base); i < (until); ++i)
#define fast ios::sy... | C++ | ad242f98f1c8eb8d30789ec672fc95a0 | 910caf13ea3b53d31c28b0ad0d059a4b | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) begin(x), end(x)
#define T ll t ; cin >> t; while(t--)
#define ll long long
#define For(base,until) for (ll (i) = (base); i < (until); ++i)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int M=1e5;
int main... | C++ | ad242f98f1c8eb8d30789ec672fc95a0 | a91d694627738d190271447000c0324a | 800 | PASSED |
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int function() {
int count, zeroCount = 0;
bool foundDup = false;
vector<int> numbers;
cin >> count;
numbers = vector<int>(count);
for (int i = 0; i < count; i++) {
cin >> numbers[i];
if (numbers[i] ... | C++ | ad242f98f1c8eb8d30789ec672fc95a0 | 8a8ece0cc78eec8ec13f4f6b84a89843 | 800 | PASSED |
#include<algorithm>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
int l,r,u,d;
int m,n;
char s[2000005];
int main(){
// freopen("test.INP","r",stdin);
int t;
scanf("%d", &t);
while(t--){
int r1 = 0,d1 = 0;
int cor1 = 1;
int cor2 = 1;
l = r... | C++ | 585bb4a040144da39ed240366193e705 | 5060934b26d2e5885183d4eb73636ed1 | 1,600 | PASSED |
#include<algorithm>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
int l,r,u,d;
int m,n;
int main(){
// freopen("test.INP","r",stdin);
int t;
scanf("%d", &t);
while(t--){
int r1 = 0,d1 = 0;
int cor1 = 1;
int cor2 = 1;
l = r = d = u = 0;
... | C++ | 585bb4a040144da39ed240366193e705 | 12e43fa0a35b03fa0c6c7ecb0c5a1857 | 1,600 | PASSED |
#include<algorithm>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
int l,r,u,d;
int m,n;
int main(){
// freopen("test.INP","r",stdin);
int t;
scanf("%d", &t);
while(t--){
int r1 = 0,d1 = 0;
int cor1 = 1;
int cor2 = 1;
l = r = d = u = 0;
... | C++ | 585bb4a040144da39ed240366193e705 | c942338de7727bf59332a69b50610fe1 | 1,600 | PASSED |
#include<algorithm>
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
int l,r,u,d;
int m,n;
int main(){
// freopen("test.INP","r",stdin);
int t;
scanf("%d", &t);
while(t--){
int r1 = 0,d1 = 0;
int cor1 = 1;
int cor2 = 1;
l = r = d = u = 0;
... | C++ | 585bb4a040144da39ed240366193e705 | d1a1cadc382d296cfc72151bd20492c5 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int test;
cin>>test;
while(test--){
int n,m;cin>>n>>m;
string s;cin>>s;
int x=0,y=0,minx=0,maxx=0,miny=0,maxy=0,ansx=1,ansy=1;
for(int i=0;i<s.size();i++){
if(s[i]=='L')y--;
if(s[i]=='R')y++;
if(s[i]==... | C++ | 585bb4a040144da39ed240366193e705 | 481d18e803c71fe4e25109828da405a0 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int test;
cin >> test;
for (int i = 0; i < test; i++){
int n, m;
cin >> n >> m;
string s;
cin >> s;
int l = s.size();
int U = 0, D = n, L = 0, R = m;
int cntU = 0,... | C++ | 585bb4a040144da39ed240366193e705 | 1e27ed2ef4bf016987988d90adff77ec | 1,600 | PASSED |
#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
using namespace std;
int main()
{
ios::sync_with_stdio(fals... | C++ | 585bb4a040144da39ed240366193e705 | adf442745b0eec9429a2f22dc8ebb295 | 1,600 | PASSED |
// Problem:
// Contest:
// URL:
// Memory Limit: MB
// Time Limit: ms
// author:
// solution:
#include <bits/stdc++.h>
#pragma gcc optimize(2)
#define ll long long
#define endl '\n'
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n... | C++ | 585bb4a040144da39ed240366193e705 | ce9c6e767f095015eb4fa4065ca9e96e | 1,600 | PASSED |
// Problem:
// Contest:
// URL:
// Memory Limit: MB
// Time Limit: ms
// author:
// solution:
#include <bits/stdc++.h>
#pragma gcc optimize(2)
#define ll long long
#define endl '\n'
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n, m;
cin >> n... | C++ | 585bb4a040144da39ed240366193e705 | f3c713b98dd9cb06b2a66fe006d8298e | 1,600 | PASSED |
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define Pair pair<ll,ll>
#define iPair pair<int,int>
#define newL cout<<endl
#define ll_max 1e18
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#d... | C++ | 585bb4a040144da39ed240366193e705 | fbbce9e93e9f89d9e66b2209952555f8 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define N 200005
struct node{
int num;
string s;
}arr[N];
bool cmp(node a, node b){
if(a.s == b.s){
return a.num < b.num;
}
return a.s < b.s;
}
int main(){
int t;
cin >> t;
int n;
string s;
while(t--){
cin >> n;
for(int i = 0; i ... | C++ | c3df88e22a17492d4eb0f3239a27d404 | 55870a1145415e5129fc811f96709cf5 | 1,300 | PASSED |
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <vector>
#include <limits.h>
#include <assert.h>
#include <f... | C++ | c3df88e22a17492d4eb0f3239a27d404 | c5475579ab7c824c2863833fceef6d07 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[300000];
char s[300000];
int tag[300000];
const int N=200010;
struct node
{
int v;
int maxn,minn;
}t[N];
bool cmp(node a,node b)
{
if(a.minn!=b.minn) return a.minn<b.minn;
else return a.v<b.v;
}
signed main()
{
int w;
int... | C++ | c3df88e22a17492d4eb0f3239a27d404 | 82655472bbef5513b6f61bd6c959b19b | 1,300 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=200005;
int a[maxn],r[maxn],b[maxn],t,n;
char s[maxn];
void solve()
{
int totb=0,totr=0;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a[i];
}
cin>>s+1;//当是B时候能减一,当时R时候只能加一。
... | C++ | c3df88e22a17492d4eb0f3239a27d404 | db30d95d409a722e6225d678ba321639 | 1,300 | PASSED |
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
void solve()
{
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i ++ ) cin >> a[i];
string s;
cin >> s;
... | C++ | c3df88e22a17492d4eb0f3239a27d404 | 5d4bf48423440699c2093cd145054c89 | 1,300 | PASSED |
#include<bits/stdc++.h>
const int N = 2e5 + 10;
using namespace std;
int t, a[N], B[N], R[N];
int main() {
scanf("%d", &t);
while(t--) {
int n, numB = 0, numR = 0, flg = 0; scanf("%d", &n);
for(int i = 1; i <= n; ++i) scanf("%d", a + i);
getchar();
for(int i = 1; i <= n; ++i) {
char c; scanf("%c", &c);
... | C++ | c3df88e22a17492d4eb0f3239a27d404 | 8f9398b139aadcd05fb12a9fdc271a4f | 1,300 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
int t,n,a[200005],red[200005],blue[200005];
char color[200005];
int main(){
cin>>t;
int lenr,lenb;
while(t--){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
cin>>color+1;
lenr=0,lenb=0;
for(int i=1;i<=n;i++){//将每一个元素按颜色分开
if(color[i]=='R... | C++ | c3df88e22a17492d4eb0f3239a27d404 | d94b134663e7db847296d60a93d064c1 | 1,300 | PASSED |
#include<iostream>
#include<algorithm>
using namespace std;
struct sb{
int h;
char c;
};
sb a[200005];
int r[200005],b[200005];
int main()
{
int t;
cin>>t;
while(t--){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i].h;
}
for(int i=0;i<n;i++){
cin>>a[i].c;
}
int k=0,k2=0;... | C++ | c3df88e22a17492d4eb0f3239a27d404 | 8ccbcd4ef9be1c83da39a76f36bc341e | 1,300 | PASSED |
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
int b[200005],r[200005];
int main()
{
int t;
cin>>t;
while(t--)
{
int n,b1=0,r1=0;
cin>>n;
int a[200005];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
char k;
cin>>k;
... | C++ | c3df88e22a17492d4eb0f3239a27d404 | e09c75bf72844017b245065eb2d921f0 | 1,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int a[200005],r[200005],b[200005],n,t;
char c[200005];
int main(){
cin>>t;
while(t--){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
cin>>c+1;
int rr=0,bb=0;
for(int i=1;i<=n;i++){
if(c[i]=='R'){
rr++;
r[rr]=a[i];
}
else{
... | C++ | c3df88e22a17492d4eb0f3239a27d404 | ab1b824993d579a015a7305943c9f442 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define IOS \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
typedef long long ll;
const int INF = 0x3f3f3f3f;
int a[1111];
int main()
{
int t;
cin >> t;
int cnt = 0;
while (t--) {
int... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 7f723eb58882ed96142738a0ea7215b4 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll solve(string k, string w){
map <char, int> posk;
ll ans = 0;
for(ll i = 0; i < k.size(); i++){
posk[k[i]] = i;
}
for(ll i = 1; i < w.size(); i++){
ans += max(posk[w[i]] - posk[w[i-1]], posk[w[i-1]] - posk[w[i]... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 4e5253cd4c7fb999d6f9a0650eb422f1 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
map<char,int>mrr;
signed main()
{
int t;
cin>>t;
while(t--)
{
for(int i=1;i<=26;i++)
{
char c;
cin>>c;
mrr[c]=i;
}
string s;
cin>>s;
int sum=0;
for(int i=1;i<s.size();i++)
{
sum+=abs(mrr[s[i]]-mrr[s[i-1]]);
}
cout<<s... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 0a835e9353b4d1fa8fef0e4c3f650a5d | 800 | PASSED |
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int ans(){
string alfa;
string word;
cin >>alfa >> word;
int resp = 0;
int aux[26];
for(int i=0; i< 26; i++)
aux[alfa[i]-'a'] = i;
//mapa do alfabeto
int cur = aux[word[0]- 'a'];
... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | cba328ec496def244aa15d686039e9f5 | 800 | PASSED |
#include<iostream>
#include<string>
using namespace std;
int main()
{
int t;
cin>>t;
string word;
int a[50];
for(int i=1;i<=t;i++)
{
char tmp;
for(int j=1;j<=26;j++)
{
cin>>tmp;
a[(int)tmp-96]=j;
}
cin>>word;
int sum=0;
for(int j=1;j<=word.length()-1;j++)
{
if((a[(int)... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | e4746a7f09f5b954b349f9c1f21bab1d | 800 | PASSED |
#include <map>
#include <iostream>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <deque>
#include <iomanip>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include<unordered_set>
#define... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | a76103d885d8aacd0670bf6963f5e7b9 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define srand srand(time(NULL))
#define random(x) rand() % (x)
#define il inline
#define ptc putchar
#define reg register
#define mp make_pair
typedef __int128 LL;
typedef long long ll;
typedef pair<int, int> PII;
namespace cyyh {
template <typename T>
il void read(T &x) ... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 1a9de0ca354e4dd3dfa1478ac4f2dc01 | 800 | PASSED |
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
char c[60],ab[26];
int a[60];
int t,sum,k;
cin>>t;
while(t--)
{
a[0]='\0';
sum=0,k=0;
scanf("%s",&ab);
scanf("%s",&c);
for(int i=0;i<strlen(ab);i++)
{
a[ab[i]-'a']=i;
}
for(int i=1;i<strlen(c);i++)
{
sum... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 947bf149cbd2cfc589ccdfd27b3b0fb5 | 800 | PASSED |
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
string a, b;
cin >> a >> b;
int sum = 0;
for (int i = 0; i < b.size() - 1; i++) {
sum += abs(int((a.find(b[i])) - a.find(b[i + 1])));
}
cout << sum<<endl;
//find是查找函数
}
}
... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 6ff27b1723a497c6dbe5e709cd8facfe | 800 | PASSED |
#include <iostream>
#include <map>
#include <string>
#include<unordered_map>
#include <cmath>
using namespace std;
unordered_map<char, int>letter;
int main() {
int t;
char alp;
string str,ws;
cin >> t;
while (t--)
{
int ans = 0;
cin >> ws;
cin >> str;
for (int i = 0; i < 26; i++)
{
letter[ws[i]] = i+... | C++ | 7f9853be7ac857bb3c4eb17e554ad3f1 | 54f22f2a71fbf9c1393e3a83acc4a1df | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int>a(n);
int minn = 0x3f3f3f3f;
for (int i = 0; i < n; i++)
{
cin >> a[i];
minn = min(minn, a[i]);
}
int ans = minn;
sort(a.begin(), a.end());
for (int j = 0; j < n - 1; j++)
... | C++ | 4bd7ef5f6b3696bb44e22aea87981d9a | c9fa13935d2940195ea04731cb28157d | 1,000 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.