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 <stdio.h>
#include <string.h>
char a[1000005];
int cnt[1000005];
int main() {
scanf("%s", a);
int len=strlen(a);
__int64 ans=1;
int i;
memset(cnt,0,sizeof(cnt));
for(i=0; i<len; i++) {
if(a[i]+a[i+1]-96 == 9 && a[i]!='0' && a[i]!='9') {
cnt[i]++;
cnt[i+... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 9ff91ed7ca4e360267b2f655215c902d | 1,500 | PASSED |
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
string s;
int main(){
ll ans = 1, flag = 0;
cin >> s;
for(int i = 1; i < s.size() - 1; i ++){
if(s[i] + s[i-1] - '0' - '0' == 9 && s[i] + s[i+1] - '0' - '0' == 9)
flag ++;
else{
if(flag & 1... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 01467fb941a88c1f1fce89dff7841553 | 1,500 | PASSED |
#include<stdio.h>
#include<string>
#include<string.h>
#include<set>
#include<queue>
#include<vector>
#include<map>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define ll long long
char c[1000005];
int main()
{
ll num,ans;
while(~scanf("%s",c))
{
ans=1;
num=0;
int n=st... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | cfe9373ec51f3b51c24d21dfcdac95ed | 1,500 | PASSED |
#include<stdio.h>
#include<string.h>
char a[100005];
int main()
{
scanf("%s",a);
int len=strlen(a);
int flag=0;
long long sum=1;
long long k=0;
a[len]='9';
for(int i=1;i<=len;i++)
{
if(a[i]+a[i-1]-2*'0'==9)
{
k++;
flag=1;
//printf("%c... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 3779b140dcb4965b06c784371025f534 | 1,500 | PASSED |
#include<cstdio>
#include<cstring>
typedef long long ll;
char word[100005];
int main()
{
while(~scanf("%s",word))
{
int len=strlen(word);
ll sum=1;
ll num=1;
for(int i=1;i<len;i++)
{
if((word[i]-'0')+(word[i-1]-'0')==9)
{
num++;
... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 44db918224f4cd879f7bf73d2cdbb5f8 | 1,500 | PASSED |
#include <stdio.h>
#include <string.h>
#define TT 100000+2
char a[TT];
__int64 solve ( ) {
int len=strlen (a);
__int64 save=1,s=1;
for (int i=00;i<len;i++) {
if (a[i]+a[i+1]-2*'0'==9)
save++;
else {
if (save%2==1)
s=s*(save+1)/2;
save=1;
}
}
return s;
}
int main ( ) {
while (gets(a)) {
__int64... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 387870d452119cf5d9f45831cd9633d0 | 1,500 | PASSED |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | ca3c5263f09fa5bd13ad682ba0d6e49c | 1,500 | PASSED |
#include <bits/stdc++.h>
#define ill unsigned long long
using namespace std;
const int INF = 1e9 + 7;
const int MXN = 1e5 + 7;
char s[MXN];
ill n, ans = 1;
int main()
{
gets(s);
n = strlen(s);
ill cur = 0;
for (int i = 0; i < n; i++)
{
if (s[i] + s[i + 1] - 96 == 9)
{
... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 217114cacd89cb0c7c2b91ce72b667fb | 1,500 | PASSED |
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
char ch;
int arr[10000000],i,flag=0,count=0;
long long c,n=1;
do
{
cin.get(ch);
if(ch>='0' && ch<='9')
{
arr[count]= int(ch)-'0';
count++;
}
}while(ch>='0' && ch<='9');
... | C++ | bb1e110a7f53e6f7d43ddced7407f3d1 | 03d2577d5d1ee1faa5596e450a0f7f69 | 1,500 | PASSED |
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
int Xa,Xb,Xc,Xd,Ya,Yb,Yc,Yd,q;
int main(){
cin>>Xa>>Ya>>Xb>>Yb;
if(Xa==Xb){
q=abs(Ya-Yb);
Xc=Xa+q;
Xd=Xb+q;
Yc=Ya;
Yd=Yb;
cout<<Xc<<" "<<Yc<<'\n';
cout<<Xd<<" "<<Yd<<'\n';
}
else
if(Ya==Yb){
q=abs(Xa-X... | C++ | 71dea31e1244797f916adf5f526f776e | 1767c259757c24945606f8a6177550e7 | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x1,x2,x3,x4,y1,y2,y3,y4,tmp;
cin>>x1>>y1>>x2>>y2;
if(x1==x2 or y1==y2)
{
if(x1==x2 and y1!=y2)
{
tmp = abs(y1-y2);
cout<<x1+tmp<<" "<<y1<<" "<<x2+tmp<<" "<<y2;
}
else if(y1==y2 and x1... | C++ | 71dea31e1244797f916adf5f526f776e | 8c657aaba4d65af272f4c4661a685a96 | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a , b , x , y , m , n;
cin >> a >> b >> x >> y;
if((a != x)&&( b != y) && (abs(a - x) == abs(b - y)))
{
cout << x << ' ' << b << ' ' << a << ' ' << y << '\n';
return 0;
}
m = abs(a - x);
n = abs(b - y);
if(n... | C++ | 71dea31e1244797f916adf5f526f776e | 267bfaca2084c8a4405c2d51565556a5 | 1,200 | PASSED |
#include <iostream>
using namespace std;
int coordinate(int a,int d)
{
if(a+d>-1000 && a+d<1000)
return a+d;
else
return a-d;
}
int main(int argc, char const *argv[])
{
int x1,x2,y1,y2;
cin>>x1>>y1>>x2>>y2;
int d;
if((x2!=x1) && (y2!=y1))
{
double k=(double)(y2-y1)/(x2-x1);
//cout<<k<<endl;
if(k=... | C++ | 71dea31e1244797f916adf5f526f776e | d70cac963826da5bd7ee346a0809f73b | 1,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main(){
int x1,x2,xa,xb,y1,y2,ya,yb,absx,absy;
cin >> x1>>y1>>x2>>y2;
absy=abs(y1-y2);
absx=abs(x1-x2);
if(x1==x2){
xa=x1+absy;
xb=xa;
ya=y1;
yb=y2;
cout << xa << " " << ya << " " << xb << " " << yb;
}e... | C++ | 71dea31e1244797f916adf5f526f776e | 037c6d140c123a05e21c16a31cef1f3e | 1,200 | PASSED |
#include <iostream>
#include <string>
#include <vector>
#include <set>
//#include <algorithm>
using namespace std;
int main()
{
int x1,y1,x2,y2,x,y;
cin>>x1>>y1>>x2>>y2;
x=max(abs(x2-x1),abs(y2-y1));
if(abs(x2-x1)==abs(y2-y1))
cout<<x1<<" "<<y2<<" "<<x2<<" "<<y1<<endl;
else if(x1==x2)
cout<<x1+x<<" "<<y1<<" ... | C++ | 71dea31e1244797f916adf5f526f776e | be45f8f0b04b2ba11ff1707a4cbbc913 | 1,200 | PASSED |
#include <iostream>
#include <math.h>
using namespace std;
int main(){
int x1,x2,x3,x4,y1,y2,y3,y4;
cin >> x1 >> y1 >> x2 >> y2;
if(x1==x2){
int len = abs(y1-y2);
y3 = y1; y4 = y2;
x3 = x1 - len; x4 = x2 - len;
if(x3 >= -1000){
cout << x3 << " " << y3 << " " << ... | C++ | 71dea31e1244797f916adf5f526f776e | 012c7f50ce48c75316d2aa51418201dc | 1,200 | PASSED |
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<iomanip>
#include<stack>
#include<map>
#include<set>
#define debug(x) cerr<<#x<<"="<<x<<endl
#define INF 0x7f7f7f7f
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
inline int init()... | C++ | 71dea31e1244797f916adf5f526f776e | 6ee442414ef33f3babba90e70cdf5d34 | 1,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int x1,x2,x3,x4,w1,y2,y3,y4;
int main(){
scanf("%d%d%d%d",&x1,&w1,&x2,&y2);
if (x1==x2){
if (x1+abs(w1-y2)<=1000) {
x3=x1+abs(w1-y2);
printf("%d %d %d %d",x3,w1,x3,y2);
}
else if (x1-abs(w1-y2)>=-1000){
x3=x1-abs(w1-y2);
printf("%d %d %d %d",x3,w1,x3,y2... | C++ | 71dea31e1244797f916adf5f526f776e | 71097d8d333bdfcebbaa6a33dc5c9e2c | 1,200 | PASSED |
#include<cstdio>
//#include<bits/stdc++.h>
//using namespace std;
int x1,x2,y1,y2;
int main(){
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
//cin>>x1>>y1>>x2>>y2;
if(x1==x2){
printf("%d %d %d %d",x1+(y1-y2),y1,x1+(y1-y2),y2);
}else if(y1==y2){
printf("%d %d %d %d",x1,y1+(x2-x1),x2,y1+(x2-x1));
}else if((x1-x2)==(y1-y2))... | C++ | 71dea31e1244797f916adf5f526f776e | e5b053b85eff56cf26f513ebc41f1783 | 1,200 | PASSED |
#include<bits/stdc++.h>
#define mem(ara,n) memset(ara,n,sizeof ara)
#define INF 2147483647
#define ll long long
#define all(n) n.begin(),n.end()
#define inf INF
using namespace std;
ll n,ara[101][101],pset[101];
ll get_point(ll ac,ll ttl)
{
if(ac*2>ttl)return 500;
if(ac*4>ttl)return 1000;
if(ac*8>ttl)retur... | C++ | bb68a49399e501739782601795609105 | c636e779e4d550351659134afd9c85ca | 2,000 | PASSED |
#include<bits/stdc++.h>
#define X first
#define Y second
#define eb push_back
#define siz(a) int(a.size())
#define trace2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d) ... | C++ | bb68a49399e501739782601795609105 | 78d8c7316e84786d3bb99a4a93025843 | 2,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,f,t) for(int i=(int)f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=(int)f; i>(int)t; i--)
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define pb push_back
#define SYNC ios_base::sync_with_stdio(false)
#define inf 2000248012
#define mp make_pair
#defi... | C++ | bb68a49399e501739782601795609105 | 73d567be5456f62b430a7a30da11c108 | 2,000 | PASSED |
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#... | C++ | bb68a49399e501739782601795609105 | 8366a8852a67b6f742923f3257bc524d | 2,000 | PASSED |
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
using namespace std;
const int maxn = 1005;
const int INF = 0x3f3f3f3f;
#define i64 __int64
int a[123][6];
int p[6];
int ling[6];
int n;
int fen(i64 x,i64 y) {
if (2 * y >... | C++ | bb68a49399e501739782601795609105 | 2a037d87ac0621b7ec2c457299490323 | 2,000 | PASSED |
#include "bits/stdc++.h"
using namespace std;
int Times[3][5] , Sub[6] , N;
double Calculate_Score( int j ){
int i;
double Score = 0 , Num , Temp;
for( i = 1 ; i <= 5 ; i++ ){
Num = (double)Sub[i] / N;
if( Times[j][i] == -1 )
continue;
if( Num > 0.5 ){
... | C++ | bb68a49399e501739782601795609105 | 71f911c581ea5ab0cc7847e4bb2ce905 | 2,000 | PASSED |
/*input
5 3
1 2 1 3 2
2 5 3
1 2 3
5 5 2
*/
#include <bits/stdc++.h>
#include <unistd.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#defin... | C++ | f5bebe1c91de4492ad7516c7607530db | ed20872f07adf24dc050908b44895d13 | 2,500 | PASSED |
/*input
4 2
1 1 2 2
1 3 2
1 4 2
*/
#include <bits/stdc++.h>
#include <unistd.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll in... | C++ | f5bebe1c91de4492ad7516c7607530db | 183edac06f937c36b8acae6cd9598018 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int base = 1357;
const int maxn = 3e5 + 100;
int a[maxn];
vector<int> vt[maxn];
int rrr = 1;
int get(int x, int val) {
return upper_bound(vt[x].begin(), vt[x].end(), val) - vt[x].begin();
}
struct Node {
Node * l, * r;
int val;
Node() {
l = r... | C++ | f5bebe1c91de4492ad7516c7607530db | 8fcfbb76866c3d488ab82ac2a96e3a07 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define MAX 110000
#define EPS 1e-9
#define INF 1e7
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define se ... | C++ | f5bebe1c91de4492ad7516c7607530db | 1e3374606c46bd0d5a47700aeaf292bc | 2,500 | PASSED |
#include <stdio.h>
#include <bits/stdc++.h>
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a... | C++ | f5bebe1c91de4492ad7516c7607530db | 7eec9b60077353362b58b4d4e169205c | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())
vector <int> PE [300010];
int g_seed;
void fast_srand(int seed) {
g_seed = seed;
}
int fast_rand(void) {
g_seed = (214033*g_seed+2531011);
return (g_seed>>16)&0x7FFF;
}
const int INF = 1e7;
int vis [300010], arr[300010];
int mai... | C++ | f5bebe1c91de4492ad7516c7607530db | eccd2c4e579711c7432976000a875755 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())
vector <int> PE [300010];
int g_seed;
void fast_srand(int seed) {
g_seed = seed;
}
int fast_rand(void) {
g_seed = (214033*g_seed+2531011);
return (g_seed>>16)&0x7FFF;
}
const int INF = 1e7;
int vis [300010], arr[300010];
int mai... | C++ | f5bebe1c91de4492ad7516c7607530db | c32636b129760302959931065fd6cbfa | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
const int MAXN = 200002;
lli ST[MAXN * 3], Lazy[MAXN * 3];
int tam;
void Set(int id, lli val, int n = 1, int l = 1, int r = MAXN - 1) {
if ((l > id) || (r < id)) return;
int ls = (n << 1), rs = ls + 1, m = (l + r) / 2;
if (Lazy[n] && (l != r)) ... | C++ | d43d4fd6c1e2722da185f34d902ace97 | 7e60b1fae523abb0a5d9e91f04de3866 | 1,600 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
#define N 1000009
#define ld double
using namespace std;
ld v[200009];
int szz=1;
ld ad[200009],sum,sz=1;
int main()
{
int n;
scanf("%d",&n);
ld k,a;
int... | C++ | d43d4fd6c1e2722da185f34d902ace97 | aa85742458e6635afa5e3254e681bc91 | 1,600 | PASSED |
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpi... | C++ | d43d4fd6c1e2722da185f34d902ace97 | 8c8b380138c051a65c8fef2c5fa53472 | 1,600 | PASSED |
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpi... | C++ | d43d4fd6c1e2722da185f34d902ace97 | b22eac63a76881177f6c5d779f8fcd37 | 1,600 | PASSED |
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpi... | C++ | d43d4fd6c1e2722da185f34d902ace97 | 7260948cf1469ad2abfa56111dce81f7 | 1,600 | PASSED |
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int, int >pii;
typedef vector < int >vi;
typedef vector < pii > vpi... | C++ | d43d4fd6c1e2722da185f34d902ace97 | 9fc1fda80f618032ff3651157d7e6d68 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
long long sum;
int m = 1;
long long v[N], w[N], T[N];
int main() {
int n;
scanf("%d", &n);
while (n--) {
int t, a, b;
scanf("%d", &t);
if (t == 3) {
if (m > 1)
w[m - 1] += w[m], sum -= v[m] + w[m--];
} else i... | C++ | d43d4fd6c1e2722da185f34d902ace97 | b2838abc7bf1950fac23ae94220b6925 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
long long sum;
int m = 1;
long long v[N], w[N], T[N];
int main() {
int n;
scanf("%d", &n);
while (n--) {
int t, a, b;
scanf("%d", &t);
if (t == 3) {
if (m > 1)
w[m - 1] += w[m], sum -= v[m] + w[m--];
} else i... | C++ | d43d4fd6c1e2722da185f34d902ace97 | d00ea19f014da4cca74ce647f38c82d7 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define trace(x) cerr << #x << ": " << x << " ";
#define tracen(x) cerr << #x << ": " << x << "\n";
typedef long long lolo;
typedef unsigned long long ulolo;
typedef pair<int, int> point;
#define fi first
#define se second
const int INF = 1e9 + 23;
const int MOD = 1e9 +... | C++ | d43d4fd6c1e2722da185f34d902ace97 | e2c55d8384bca20f529a7c3afdc9b8b6 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int n,cnt=1,a,b,c,lindex=0;
double sum=0,ans;
scanf("%d",&n);
int arr[200001]={0};
int edit[200001]={0};
for(int i=0;i<n;i++)
{
scanf("%d",&a);
if(a==1)
{
scanf("%d%d",&b,... | C++ | d43d4fd6c1e2722da185f34d902ace97 | 663276e885c0bbe2b45e90666e41d5d8 | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 0x3c3c3c3c;
const ll INFL = 0x3c3c3c3c3c3c3c3c;
const int MAX_N = 1e5 + 9;
int D[MAX_N];
vector<int> toDist[MAX_N];
vector<pair<int, int>> G;
int main(){
cin.sync_with_stdio(false);
cin.tie(NULL);
cout.sy... | C++ | 73668a75036dce819ff27c316de378af | 14c12dbcfea33a81b9619ff848497486 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005;
int n,k,e[N],mx;
vector<int>g[N];
bool f(int b){
if(e[0]!=1){ return 0; }
for(int x=1 ; x<=b ; x++){
ll c=(ll)e[x-1]*(x==1 ? k : k-1);
if(e[x]>c){ return 0; }
}
return 1;
}
void setup();
int main... | C++ | 73668a75036dce819ff27c316de378af | a65e99435e0a4393b15e823b935469c3 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define forn(a,b,c) for (int a=b; a<c; ++a)
typedef long long ll;
#define ifile freopen("ladder.in", "r", stdin)
#define ofile freopen("ladder.out", "w", stdout)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define PI 3.141592653589793238462643383279
... | C++ | 73668a75036dce819ff27c316de378af | e8ecef4f8bae73332a971975feb4ffe6 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <ll,ll> pll;
set <pll> s;
pll p;
ll d[300000],x,n,k,l=0,di=0;
vector <ll> v[300000];
int main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin >> n >> k;
for(int i=1; i<=n; i++)
{
cin >> x;
d[i]=x;
v[x].push_back(... | C++ | 73668a75036dce819ff27c316de378af | bdcb2e91f78a60a857cd425dc5dbe84b | 1,800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
queue<pair<long long,long long> > q;
vector<pair<long long,long long> > v,ans;
pair<long long,long long> b;
long long arr[1000010]={0};
long long ee;
int main()
{
long long n,k,i,a,mx=0,c;
cin>>n>>k;
for(i=0;i<n;i++)
{
cin>>a;
if(a>mx)
... | C++ | 73668a75036dce819ff27c316de378af | 2dd77536431a011cc65dbe4e2f931d9b | 1,800 | PASSED |
// in the name of God
#include<bits/stdc++.h>
#include <cmath>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define ll long long
ll n, k, cnt = 0, idx, mx = 0;
const ll MAX = (ll)1e5 + 5;
ll deg[MAX], freq[MAX], rem;
vector<ll> dist[MAX];
vector<pair<ll, ll>> ans;
bool child[MAX], stop ... | C++ | 73668a75036dce819ff27c316de378af | 5a5530c28fed5db0ea04130127e45e09 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pi pair < int, int >
#define pl pair < long long, long long >
typedef bitset < 16 > MASK;
const int MAX = 1e5 + 5;
int n, k, x, mx, dist[MAX];
vector < int > adj[MAX];
vector < pi > ans;
void dfs()
{
for(int i = 0, j = 1; j <= mx... | C++ | 73668a75036dce819ff27c316de378af | 41dd8ffa2fc17a37d67d2e15c8cb245f | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vll vector<ll>
#define pii pair<int, int>
#define vii vector<pii>
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vd vector<double>
#define vvi vector< vector<int> >
#define vvii ... | C++ | 73668a75036dce819ff27c316de378af | f7e3462eae75fa3c03d490dc10980a31 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll d[100010];
vector <ll> g[100010];
vector <ll> v[100010];
vector <pair<ll,ll> > res;
int main() {
ll n,k,cnt=0,s,prev=1,edges=0,val=-1;
cin>>n>>k;
for(ll i=0;i<n;i++)
{
cin>>d[i];
//cout<<d[i]<<endl;
val = ... | C++ | 73668a75036dce819ff27c316de378af | 40f134f50f738f5c2b9177924d919668 | 1,800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
const int N=2e5+20;
//题意:给出n个点的最短距离数组d[i],每个顶点的度数<=K,构造出满足条件的图,输出边
//先将距离d[i] 排序 距离从小到大构造边,
struct node{
int id,x;
}d[N];
bool cmp(node a,node b)
{
if(a.x==b.x)
return a.id<b.id;
return a.x<b.x;
}
int n,K;
vector<ii> ans;//u-v
vector<ii> pr... | C++ | 73668a75036dce819ff27c316de378af | b857f88fa98c1b6d83962ade6ace8a19 | 1,800 | PASSED |
#include<cstdio>
#include<cstring>
#define MAXN 1000000+1109
using namespace std;
long long m;
long long h1,a1,x1,y1,h2,a2,x2,y2;
/*long long Time1[MAXN];
long long Time2[MAXN];*/
bool b[MAXN];
long long Max=1e7;
int main()
{
scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d",&m,&h1,&a1,&x1,&y1,&h2,&a2,&x2,&y2)... | C++ | 7225266f663699ff7e16b726cadfe9ee | c94f37bdaf478195db9c8431934aaf14 | 2,200 | PASSED |
#include<cstdio>
int m, h1, a1, x1, y1, h2, a2, x2, y2;
int delta1, cycle1, delta2, cycle2, ans;
long long v;
int main() {
scanf("%d%d%d%d%d%d%d%d%d", &m, &h1, &a1, &x1, &y1, &h2, &a2, &x2, &y2);
int h = h1;
for(delta1=0;delta1<=m && h!=a1;delta1++)
h = (1LL*x1*h+y1)%m;
if(delta1>m) {
printf("-1\n");
return... | C++ | 7225266f663699ff7e16b726cadfe9ee | 0e50b6229fb6086091adf49e5700d3c6 | 2,200 | PASSED |
#include<stdio.h>
long long ok1[1000001],ok2[1000001];
long long gcd(long long x,long long y)
{
return y==0?x:gcd(y,x%y);
}
long long abs(long long x)
{
return x>0?x:-x;
}
int main()
{
long long m,h1,a1,x1,y1,h2,a2,x2,y2;
scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d",&m,&h1,&a1,&x1,&y1,&h2,&a2,&... | C++ | 7225266f663699ff7e16b726cadfe9ee | 70801e86577395a7183ff60910f2d212 | 2,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll m,a,h,x,y,n,p,u,v;
ll a1,h1,x2,y2;
main()
{
scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d",&m,&h,&a,&x,&y,&h1,&a1,&x2,&y2);
ll u1=h,u2=h1;
for (ll i=1;i<=1e6;i++)
{
h=(x*h+y)%m;
h1=(x2*h1+y2)%m;
if (h==a&... | C++ | 7225266f663699ff7e16b726cadfe9ee | a5b0c4286377ff541f1ee15671d91958 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define maxn 1000000
ll vit1[maxn], vit2[maxn];
ll gcd(ll a, ll b)
{
ll pr = a, r = b;
while(r != 0)
{
ll q = pr/r, h;
h = r;
r = pr - q*r;
pr = h;
}
return pr;
}
ll lcm(ll a, ll b)
{
return a/gcd... | C++ | 7225266f663699ff7e16b726cadfe9ee | 0cc68ca9e515e42aee5bf6683b08a6d2 | 2,200 | PASSED |
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll; typedef long double ld;
typedef pair<ll, ll> pii;
const ll MAXN = 1e6 + 10;
ll m, h1, a1, x1, y1, h2, a2, x2, y2;
ll first1[MAXN], first2[MAXN], his1[MAXN], his2... | C++ | 7225266f663699ff7e16b726cadfe9ee | 512c064104ea79907b3a9d80339fe7cc | 2,200 | PASSED |
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#define INF (1<<30)
using namespace std;
typedef long long LL;
LL mod, h1, r1, h2, r2, s, x, y, xx, yy, a1, b1, a2, b2, d, r, i, mnx, mny;
LL v1[1000005], ... | C++ | 7225266f663699ff7e16b726cadfe9ee | b3cbf68416f31a7ed9d509baf2243502 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 1e9;
ll gcd(ll a,ll b){
if(b==0)return a;
return gcd(b,a%b);
}
ll MIN(ll a,ll b){
if(a>b)return b;
return a;
}
int main(){
ll H1,H2;
ll m,h1,a1,x1,y1;
ll h2,a2,x2,y2;
cin>>m;
cin>>h1>>a1;
cin>>x1>>y1;
cin>>h2>>a2;
c... | C++ | 7225266f663699ff7e16b726cadfe9ee | 2db76c032746791312c09a3ead0a3ba6 | 2,200 | PASSED |
#from sys import stdin,stdout
#import operator
#from collections import OrderedDict
#def getKey(item):
# return item[0]
n,k=map(int,input().strip().split(" "))
#n,k=map(int,stdin.readline().rstrip().split(" "))
lst=list(map(int,input().strip().split(" ")))
#lst=list(map(int,stdin.readline().rstrip().split()))
s=in... | Python | aa3b5895046ed34e89d5fcc3264b3944 | f8c9ea7969d69d219c508f1fbcec68dc | 1,300 | PASSED |
from sys import stdin,stdout
#import operator
#from collections import OrderedDict
#def getKey(item):
# return item[0]
#n,k=map(int,input().strip().split(" "))
n,k=map(int,stdin.readline().rstrip().split(" "))
#lst=list(map(int,input().strip().split(" ")))
lst=list(map(int,stdin.readline().rstrip().split()))
#s=in... | Python | aa3b5895046ed34e89d5fcc3264b3944 | 3f071d4ba3c73b7534ecdc2396f9ab2b | 1,300 | PASSED |
n,k=map(int,input().split())
a=list(map(int,input().split()))
s=str(input())
ans=0
i=0
b=[]
while(i<n):
b.append(a[i])
if(i+1>=n or (i+1<n and s[i+1]!=s[i])):
b.sort()
b.reverse()
p=0
i+=1
while(p<len(b) and p<k):
ans+=b[p]
p+=1
b=[]
... | Python | aa3b5895046ed34e89d5fcc3264b3944 | eeea2b95ab7f56f11c61599ee994260c | 1,300 | PASSED |
n, k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
buttons = input()
dmg = 0
i = 0
while i < n:
subset = []
subset.append(arr[i])
j = i + 1
if j >= len(arr):
dmg += arr[i]
break
consec = 1
currTot = 0
currTot += arr[i]
while j < n and buttons... | Python | aa3b5895046ed34e89d5fcc3264b3944 | f5f44cbc0fe87ae8a5e07066993efd32 | 1,300 | PASSED |
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
a.append(-1)
dmg = 0
d = {}
s = input() + '#'
for i in range(n + 1):
if s[i] not in d:
d[s[i]] = [a[i]]
if s[i] in d and i > 0 and s[i-1] != s[i]:
dmg += sum(sorted(d.pop(s[i-1]))[-k:])
elif s[i] in d and i > 0 and s[i-1... | Python | aa3b5895046ed34e89d5fcc3264b3944 | d15b9e524e8391b427a01c92374b1872 | 1,300 | PASSED |
n, k = map(int, input().split())
l = list(map(int, input().split()))
slist = list(input())
dmg = 0
i=0
while i<n:
j = i+1
count = 1
l_tmp = [l[i]]
while j<n and slist[i] == slist[j]:
count += 1
l_tmp.append(l[j])
j+=1
l_tmp.sort(reverse = True)
dmg += sum(l_tmp[:min(count... | Python | aa3b5895046ed34e89d5fcc3264b3944 | b3a9d531d0e296b8e6a9d0a51532e479 | 1,300 | PASSED |
n,b=input().split()
n=int(n)
b=int(b)
j=0
lt=[]
tempLt=[]
lt=list(map(int,input().split()))
str=input()
for i in range(len(str)):
if i==0:
tempLt.append(lt[i])
j=0
elif str[i]==str[i-1]:
tempLt.append(lt[i])
else:
tempLt.sort()
tempLt.reverse()
for k in range(... | Python | aa3b5895046ed34e89d5fcc3264b3944 | 00a45ee03aa92e6abf5bb02bae67c486 | 1,300 | PASSED |
import sys
n, k = [int(s) for s in input().split()]
array = [int(s) for s in input().split()]
string = input()
counter = 0
extra = []
sum_ = 0
if len(string) == 1:
print(array[0])
sys.exit(0)
for i in range(len(string) - 1):
if string[i] == string[i + 1]:
counter += 1
right = i + 1
#... | Python | aa3b5895046ed34e89d5fcc3264b3944 | 2ee8db83a18321dd92af2fe316a26938 | 1,300 | PASSED |
k=[int(e) for e in input().split()]
l1=[int(e) for e in input().split()]
s=input()
l=[[l1[0]]]
for i in range(1,k[0]):
if s[i]==s[i-1]:
l[-1].append(l1[i])
else:
l.append([l1[i]])
sm=0
for i in l:
if len(i)<=k[1]:
sm+=sum(i)
else:
i.sort(reverse=True)
sm+=sum(i[:k... | Python | aa3b5895046ed34e89d5fcc3264b3944 | 822cc7e3c5a2d64d426d53ce87315ce6 | 1,300 | PASSED |
n,k = map(int,input().split())
arr = list(map(int,input().split()))
string = input()
if n == 1 or n < k:
print(sum(arr))
exit()
i,j = 0,1
sums,add = [0]*n,0
sums[0],ans = arr[0],0
while(j < n):
if string[i] == string[j]:
while(j < n and string[i] == string[j] ):
j += 1
if string... | Python | aa3b5895046ed34e89d5fcc3264b3944 | c63d44613248cbca1f2a850f9045cdd8 | 1,300 | PASSED |
using System;
using System.IO;
using System.Collections.Generic;
namespace CodeForces36_A
{
class Program
{
static void Main(string[] args)
{
StreamReader sr = new StreamReader("input.txt");
int len = Convert.ToInt16(sr.ReadLine());
string s = sr.ReadLine();... | C# | 4fc1ca3517168842cc85d74ba0066598 | fd6377b492fc869ef9ef23b63ac15e04 | 1,300 | PASSED |
using System;
using System.IO;
using System.Text;
namespace Task_36A
{
class Program
{
static void Main(string[] args)
{
//int N = int.Parse(Console.ReadLine());
//string s = Console.ReadLine(), ans = "YES";
string s, ans = "YES";
int N;
... | C# | 4fc1ca3517168842cc85d74ba0066598 | 8ed3f40bf1c9521da2e85255f3e33f95 | 1,300 | PASSED |
using System;
using System.IO;
using System.Text;
namespace Task_36A
{
class Program
{
static void Main(string[] args)
{
//int N = int.Parse(Console.ReadLine());
//string s = Console.ReadLine(), ans = "YES";
string s, ans = "YES";
int N;
... | C# | 4fc1ca3517168842cc85d74ba0066598 | c48a8ce9582cdd1fe47247a7e7a38e76 | 1,300 | PASSED |
package main
import "fmt"
import "os"
func main(){
var(
s string
i,j int
old int = 0
ok bool = true
)
fin,_:=os.Open("input.txt")
fout,_:=os.Create("output.txt")
defer func(){
fin.Close()
fout.Close()
}()
fmt.Fscanf(fin,"%s\n%s",&s,&s)
for i=0;s[i]==byte('0')&&i<len(s);i++{}
... | Go | 4fc1ca3517168842cc85d74ba0066598 | 7733462f5446db63f27d41362c0f3150 | 1,300 | PASSED |
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
)
func main() {
file, err := os.Open("input.txt")
if err != nil {
log.Fatal(err)
}
defer file.Close()
resp, errC := os.Create("output.txt")
if errC != nil {
log.Fatal(errC)
}
defer resp.Close(... | Go | 4fc1ca3517168842cc85d74ba0066598 | b6065575d9e6aae3dd075b09602d15ab | 1,300 | PASSED |
<?php
$in = fopen("input.txt", 'r');
$out = fopen("output.txt", 'w');
while (!feof($in)) {
$get[] = fgets($in);
}
$get = explode("\n", implode("", $get));
$n = $get[0];
$signals = ltrim(rtrim($get[1], "0\n"), "0");
$interval = -1;
$zeros = 0;
for($i=1;$i<s... | PHP | 4fc1ca3517168842cc85d74ba0066598 | fc2c585f91449983976992361cfbca91 | 1,300 | PASSED |
inp = open('input.txt', 'r')
out = open('output.txt', 'w')
n=int(inp.readline())
a=inp.readline()
ans=[]
for i in range(len(a)):
if a[i]=='1': ans.append(i)
flag=0
d=ans[1]-ans[0]
for i in range(len(ans)-1):
if ans[i+1]-ans[i]!=d:
flag=1
out.write('YES' if flag==0 else 'NO')
| Python | 4fc1ca3517168842cc85d74ba0066598 | 73059f5b109b9d1739f0fafac2b1b06f | 1,300 | PASSED |
fin = open('input.txt')
fout = open('output.txt', 'w')
n = int(fin.readline())
s = str(fin.readline())
a = set()
p = 0
d = 0
first_met = False
for i in range(n):
if s[i] == '1':
if not first_met:
first_met = True
else:
a.add(i - d)
d = i
if len(a) == 1:
print("YES... | Python | 4fc1ca3517168842cc85d74ba0066598 | 03557d302ef0757f814d38e7a8840df9 | 1,300 | PASSED |
import sys
import math
import bisect
def solve(s):
n = len(s)
A = []
for i in range(n):
if s[i] == '1':
A.append(i)
delta = -1
for i in range(1, len(A)):
if i == 1:
delta = A[i] - A[i-1]
else:
if A[i] - A[i-1] != delta:
ret... | Python | 4fc1ca3517168842cc85d74ba0066598 | 37440205d738544482d6c3372593571b | 1,300 | PASSED |
inp=open("input.txt",'r')
oup=open("output.txt",'w')
n=int(inp.readline())
s=inp.readline()
index=[]
for i in range(0,n):
if s[i]=='1':
index.append(i)
if len(index)==1:
oup.write("YES")
else:
diff=index[1]-index[0]
flag=0
for i in range(1,len(index)):
if index[i]-index[i-1]!=diff... | Python | 4fc1ca3517168842cc85d74ba0066598 | 253ca80109c64816b0c5e3a14b936986 | 1,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; float v,a[100],b[100],x,k,sa=0,minb=1e9; cin >> n >> v;
for (int i=0; i<n; i++) {
cin >> a[i]; sa+=a[i];
}
for (int i=0; i<n; i++) {
cin >> b[i];
if (b[i]/a[i]<minb) minb=b[i]/a[i];
}
k=min(v/sa,minb);
... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | 8655136904a666019463d0bfb97f941e | 1,400 | PASSED |
#include<stdio.h>
main()
{
int n;
double v,a[25],b[25],m=200.0,s=0.0;
scanf("%d%lf",&n,&v);
for(int i=0;i<n;i++)
{
scanf("%lf",&a[i]);
s+=a[i];
}
for(int i=0;i<n;i++) scanf("%lf",&b[i]);
for(int i=0;i<n;i++)
{
if(b[i]/a[i]<m) m=b[i]/a[i];
}
m=m*double(... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | 4708db6792bf3b079a84f7202af57f47 | 1,400 | PASSED |
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define eps 1e-9
double min(double a,double b)
{
if(a-b<eps) return a;
else return b;
}
int main()
{
int n,a[30],b[30],i,j;
double sum,c[30],k,v;
while(scanf("%d%lf",&n,&v)!=EOF)
{
for(i=1,sum=0;i<=n;i++)
{
... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | d6b16e4a423d6b8e153e94022537c5dd | 1,400 | PASSED |
#pragma comment(linker, "/STACK:16777216")
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <climits>
#include <cctype>
#include <cmath>
#include <cassert>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <vect... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | efd99ccc592d530a9eff8a4826087180 | 1,400 | PASSED |
// Kim Vyacheslav Karaganda KTL
// 2010
#include <cstdio>
using namespace std;
#define min(a, b) (a<b?a:b)
int n;
double c[29], m = 999999999, r, v, a[29], b[29];
int main ()
{
scanf ("%d%lf", &n, &v);
for (int i = 0; i < n; i++)
scanf ("%lf", &a[i]);
for (int i = 0; i < n; i++)
{
sc... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | f1952539aee625c46d1b3fef3b48e313 | 1,400 | PASSED |
#include<iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <cstdio>
using namespace std;
int a[111111],b[11111],dp[4111][3];
int n,l=0,m,x,y,ans;
int main() {
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int t=0,n2=0,j,i,z=0,n=0,m=0;
cin>>n>>t;
for (i=0;i<n;i++) {... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | 4dc755ae4cf905ea658965d497daf59e | 1,400 | PASSED |
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n, v;
cin >> n >> v;
vector <int> a(n), b(n);
for(int i=0; i<n; ++i)
cin >> a[i];
for(int i=0; i<n; ++i)
cin >> b[i];
double m = 1000*1000*1000, res = 0.00;
fo... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | a1c411c6da4b4eb1191addc455d69b84 | 1,400 | PASSED |
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int i,n,a[1001], b[1001] ,sa,j;
double x=1e9, sb,v,s;
int main(){
cin>>n>>v;
for(i=0;i<n;++i){
cin>>a[i];
sa+=a[i];
}
for(i=0;i<n;++i) {
cin>>b[i];
sb = (d... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | 7ca570d3e1406218627d3c0a06c9d85b | 1,400 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<double> a,b;
int main(){
int i,j,n;
double V,x,P;
//system("pause");
cin>>n>>V;
for(i=0;i<n;++i){
cin>>x;
a.push_back(x);
}
for(i=0;i<n;++i){
cin>>x;
b.push_back(x);
... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | a7f6a692b12df62f605d109f6e4914a1 | 1,400 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
vector<double> a,b;
int main(){
int i,j,n;
double V,x,P;
//system("pause");
cin>>n>>V;
for(i=0;i<n;++i){
cin>>x;
a.push_back(x);
}
for(i=0;i<n;++i){
cin>>x;
b.push_back(x);
... | C++ | 351d8874a10f84d157a7b2e1eb64e2a1 | 1124899f8abf357ac051d853b15f2a62 | 1,400 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;
int t, n, a[305];
long long maxn;
bool judge(int l, int r, long long num) {
for(int i = l + 1; i < r; ++i) {
if(num % i == 0) return false;
}
return true;
}
int main() {
cin >> t;
a[0] = 1;
whil... | C++ | fe9b1527571ea37f402512ac378dee13 | 845db27d13f7decd6beaed9341f6e6fe | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
bool check(int *p,int n)
{
for(int i=0;i<n;i++)
{
int m=p[i],j;
for(j=2;j<sqrt(m);j++)
{
if(m%j==0)
{
int r=0;
for(int k=0;k<i;k++)
{
if(p[k]==j||p[k]==m/j)
r++;
}
if(r!=2)
return 0;
}
}
if(j*j==m)
{
int r=0;
fo... | C++ | fe9b1527571ea37f402512ac378dee13 | 56deb4b263eee4b7bc7c264e26ee2da4 | 1,600 | PASSED |
#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
ll t, n, m, v[N];
int main(){
cin>>t;
for(int j=1; j<=t; j++){
cin>>n;
for(int i=1; i<=n; i++)
cin>>v[i];
sort(v+1, v+1+n);
ll x=v[1]*v[... | C++ | fe9b1527571ea37f402512ac378dee13 | e0a0efc20a09c34fbb2413ac828334fc | 1,600 | PASSED |
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<ctype.h>
#include <algorithm>
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const ll mod=9223372034707292160;
const int maxn=2e5+5;
ll geshu(ll a)
{
int sum=0;
for... | C++ | fe9b1527571ea37f402512ac378dee13 | 8d0a2ae38ffecea630df38c197de2b62 | 1,600 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1005;
const int M=1000005;
const ll inf=0x3f3f3f3fll;
const ll mod=998244353ll;
int n,m;
ll a[N];
ll cnt[M];
void build(int x){
for(int i=2;i*i<=x;i++){
ll k=0;
while(x%i==0){
k++;
x/=i;
}
cnt[i]=max(cnt[i],k);
}
if(x>1) cnt... | C++ | fe9b1527571ea37f402512ac378dee13 | b38a62f8fa3562112a25cf1b398fef6b | 1,600 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,T;
ll a[10000010];
int main()
{
scanf("%d",&T);
while( T -- )
{
scanf("%d",&n);
for ( int i = 0; i < n; i++ )
{
scanf("%lld",&a[i]);
}
sort( a,a+n );
ll ans = a[0] * a[n-... | C++ | fe9b1527571ea37f402512ac378dee13 | 27fe278268ac0e7c91280861961473ed | 1,600 | PASSED |
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll d[310];
map<ll,bool> mp;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
mp.clear();
for(int i=0;i<n;i++){
cin>>d[i];
mp[d[i]]=1;
}
sort(d,d+n);
ll mx=d[0]*d[n-1];
bool flag=0;
for(int i=1;i<n-1;i++){
if(d[i]*d[n-1... | C++ | fe9b1527571ea37f402512ac378dee13 | bb7546553fdf8fd0d75129a2aae0995e | 1,600 | PASSED |
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#define int long long
using namespace std;
long long t,n,a[5010];
bool flag;
signed main()
{
cin>>t;
while(t--)
{
flag=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+1+n);
if(a[1]<=1)
{
cout<<-1<<endl;
cont... | C++ | fe9b1527571ea37f402512ac378dee13 | 57c904f2b927313cbe2124a60e7e4c9b | 1,600 | PASSED |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <queue>
#include <stack>
#include <map>
using namespace std;
const int INF = 0x3f3f3f3f;
long long n,m,t;
long long a[50005];
int main()
{
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
l... | C++ | fe9b1527571ea37f402512ac378dee13 | 0f834cc2141f9eeb0a3e5099a9091317 | 1,600 | PASSED |
#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
typedef long long ll;
template <typename T>
inline void read(T& x) {
T res = 0, flag = 1;
char ch;
ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') flag = -1;
... | C++ | fe9b1527571ea37f402512ac378dee13 | b4cec5b29411baa1d5ad3dc90f9ee923 | 1,600 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.