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 |
|---|---|---|---|---|---|
#pragma comment(linker, "/STACK:256000000")
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
... | C++ | 624bf3063400fd0c2c466295ff63469b | dd22445dfa0065574209c0c387398ee9 | 2,500 | PASSED |
#pragma comment(linker, "/STACK:256000000")
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
... | C++ | 624bf3063400fd0c2c466295ff63469b | dc3ae19b5d6d038b4e07b216447b6618 | 2,500 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a));
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) ... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | b86919dba96b831ae267eb9f088e64bb | 1,900 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define sz(v) (int)(v).size()
#define debug(x) cerr << #x << "_=_" << x << "\n";
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<pair<int, i... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 2eba30b052639652f2b037f0208d0cd4 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define sz(v) (int)(v).size()
#define debug(x) cerr << #x << "_=_" << x << "\n";
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<pair<int, i... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 14779f0cfc7f0108bd3c226ef1807579 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define sz(v) (int)(v).size()
#define debug(x) cerr << #x << "_=_" << x << "\n";
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<pair<int, i... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 6fbd5b2947ecd54648607cd178c86363 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e6 + 17;
const int inf = 1e18 + 7;
const int MOD = 1e9 + 7;
int dp[N];
signed main () {
dp[0] = 0;
dp[1] = 0;
dp[2] = 4;
for (int i = 3; i < N - 1; i++) {
dp[i] = dp[i - 2] * 2 + dp[i - 1];
if (i % 3 == 2... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | f1b72ffbfb9f27d2f61ca67bec7f9972 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll mod= 1e9+7;
ll dp[20000009];
int main()
{
dp[1]=0; dp[2]=0;
for(int i=3;i<2000009;i++)
{
dp[i]=(2ll *dp[i-2]%mod+dp[i-1]%mod+(i%3==0?4:0)%mod)%mod;
}
int t;
cin>>t;
while(t--)
{
ll n; cin>>n; cout<<d... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 0c05fbe90888a7674edaf9921ac201d3 | 1,900 | PASSED |
/*
author :: OneAboveAll
*/
#include <bits/stdc++.h>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b) for(auto i=a;i<=b;i++)
#define rrep(i,a,b) for(auto i=b;i>=a;i--)
#define mrep(i,m) for(auto i=m.begin();i!=m.end();i++)
#define int long long... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 15a0949bdf17095f538c59ae958914d1 | 1,900 | PASSED |
/*
author :: OneAboveAll
*/
#include <bits/stdc++.h>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b) for(auto i=a;i<=b;i++)
#define rrep(i,a,b) for(auto i=b;i>=a;i--)
#define mrep(i,m) for(auto i=m.begin();i!=m.end();i++)
#define int long long... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 4a61b30b84035bfafa81a0a89e27cb8e | 1,900 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//namespaces
using namespace __gnu_pbds;
using namespace std;
... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 08d2a42f9bde5c1034ab5aee0880576a | 1,900 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//namespaces
using namespace __gnu_pbds;
using namespace std;
... | C++ | 43ace9254c5d879d11e3484eacb0bcc4 | 46c1cb22fbdb609f97a0899b5a1a6231 | 1,900 | PASSED |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class B {
public static void main(String[] args) {
FastReader in = new FastReader();
TreeSet<Integer> list = new TreeSet<>();
... | Java | 0f100199a720b0fdead5f03e1882f2f3 | ca618e6945945eaef17483027b9bc29a | 1,000 | PASSED |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.TreeSet;
public class B {
public static void main(String[] args) throws IOException {
Reader in = new Reader();
TreeSet<Integer> list = new TreeSet<>();
int n = in.nextInt(),... | Java | 0f100199a720b0fdead5f03e1882f2f3 | a64cf6133f0ff9de48ae514934100552 | 1,000 | PASSED |
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
public class subtraction
{
void solve()throws IOException
{
/**************** write your code here ***********************/
int n=ni(),k=ni();int s=0,c=0,r=0,id=0;
... | Java | 0f100199a720b0fdead5f03e1882f2f3 | 586bf5e60ed770019f78407404f17ff4 | 1,000 | PASSED |
import java.io.*;
import java.util.*;
public class yay {
public static int mod(int a, int b){
return (a%b + b)%b;
}
public static long gcd(long a, long b)
{
if(b == 0) return a;
return gcd(b, a%b);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new Pri... | Java | 0f100199a720b0fdead5f03e1882f2f3 | a1c417845d2c7865b2cf1fc0054e0408 | 1,000 | PASSED |
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class B
{
public static void main(String [ ] args)
{
int n, k;
int[] list = new int[100001];
Scanner inn = new Scanner(System.in);
... | Java | 0f100199a720b0fdead5f03e1882f2f3 | b98b5c83eb5b7391867f477e6375e7ea | 1,000 | PASSED |
import java.util.*;
import java.io.*;
public class Main{
static int i,j,k,l,temp,count;
public static void main(String[] args) throws IOException{
/*
.
.
.
.
.
.
*/
int n=ni();
int k=ni();
int arr[]=nia(n);
Arrays.sort(arr);
i=0;
temp=0;
while(k>0 && i<n){
arr[i] -= temp;
temp += a... | Java | 0f100199a720b0fdead5f03e1882f2f3 | edadd7c0a897ef9cdd087abfa5e8daae | 1,000 | PASSED |
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define loop(i,a,b) for(ll i=a;i<=b;++i)
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define clr(x) x.clear()
#define M... | C++ | 0f100199a720b0fdead5f03e1882f2f3 | d3111b8bd795b70184436fd4bb9ff84f | 1,000 | PASSED |
#include <iostream>
#include<set>
#include<algorithm>
using namespace std;
set<int> s;
int main()
{
s.insert(0);
int n, k;
scanf("%d%d", &n, &k);
while (n--)
{
int a;
scanf("%d", &a);
s.insert(a);
}
set<int>::iterator it = s.begin();
while (k--)
{
if (next(it) == s.end())
printf("0\n");
else
{
... | C++ | 0f100199a720b0fdead5f03e1882f2f3 | aaeef8109542385deecee78dd59b1e3a | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
int a[1000006];
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie();
int n,k;
cin >> n >> k;
for(int i = 0; i < n; ++ i)
cin >> a[i];
sort(a,a+n);
int i=0;
int res=0;
int cnt=0;
while(cnt < k)
{
cout << a[i... | C++ | 0f100199a720b0fdead5f03e1882f2f3 | ff78ac0833afcb146f30561d498cf2f5 | 1,000 | PASSED |
#include<iostream>
#include<memory.h>
#include<algorithm>
using namespace std;
const int maxn = 1e5+5;
int n, k;
int a[maxn];
int main()
{
scanf("%d%d", &n, &k);
for(int i = 0;i < n;i ++)
scanf("%d", &a[i]);
sort(a, a + n);
int cnt = 0, top = 0;
while(k -- && top < n)
{
int t = a[top];
printf("%d\n", t ... | C++ | 0f100199a720b0fdead5f03e1882f2f3 | 530163c91b5d789c1d5786938b1e1eb5 | 1,000 | PASSED |
//lucky ticket
#include<map>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int main()
{
// freopen("a.in","r",stdin);
long long n;
cin>>n;
long long a;
int i=0,j=0;
vector <int> vec;
while(n--)
{
cin>>a;
vec.push_back(a);
if(a=... | C++ | 409b27044d5ec97b5315c92d4112376f | 2b8b96c6d06ab4433647ec19fa152918 | 1,000 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <set>
#include <ctime>
#include <stack>
using namespace std;
#define inf 2147483647
#define eps 0.0000000001
#d... | C++ | 409b27044d5ec97b5315c92d4112376f | 5996b728031fa062d038d74f657f4c67 | 1,000 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#define FOR(i,p,k) for(int i = (p);i<(k);i++)
typedef long long int LL;
using namespace std;
int li[10];
int n;
int main()
{
cin>>n;
FOR(i,0,n)
{
int a;
... | C++ | 409b27044d5ec97b5315c92d4112376f | b7204675310a5e218b6a8673bbd6b889 | 1,000 | PASSED |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
int main()
{ int n, a, cnt5 = 0, cnt0 = 0, i;
cin >> n;
for (i = 1; i <= n; i++)
{ cin >> a;
if (a == 5){cnt5++;}
else {cnt0++;}
}
if (cnt5 / 9 > 0)
{ if (cnt0 > 0)
{for (i = 1; i <= cnt5 ... | C++ | 409b27044d5ec97b5315c92d4112376f | 6d148bc066a242f2098aac4610223a57 | 1,000 | PASSED |
#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
int a[1000];//kol
int b[1000];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
int k=0;//tedad 0 ha
int j=0;//tedad 5 ha
for(int i=0;i<n;i++)
{
if(a[i]==0)
{
k++;
}
else
{
j++;
}
}
if(j>... | C++ | 409b27044d5ec97b5315c92d4112376f | de2aa090d73c89fa40850fb8d5e271e6 | 1,000 | PASSED |
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
int n,x,cnt[6]={};
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&x);
cnt[x]++;
}
cnt[5]=cnt[0]?cnt[5]/9:0;
cnt[0]=cnt[5]?cnt[0]:min(cnt[0],1);
for(int i=0;i<cnt[5];i++) printf("555... | C++ | 409b27044d5ec97b5315c92d4112376f | 882aab7c829c3250512531036ac3141b | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n); i--; )
#define pb pus... | C++ | 409b27044d5ec97b5315c92d4112376f | 294866f9556a21a6ea7532785170dc4c | 1,000 | PASSED |
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main()
{
int n;
cin >> n;
int a;
... | C++ | 409b27044d5ec97b5315c92d4112376f | 7e19768334dabd8e0376094d45b211db | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
void count(){
#ifndef ONLINE_JUDGE
freopen ("input.txt", "r", stdin);
#endif
}
int main(){
//count();
int n;
cin >> n;
int l = 0, r = 0;
for(int i=0; i<n; ++i){
char x;
cin >> x;
if(x == '0') l ++;
else r +... | C++ | 409b27044d5ec97b5315c92d4112376f | 60e2954f88b8e4d3fdc501cada5e9a43 | 1,000 | PASSED |
#include<iostream>
using namespace std;
int main()
{
int i,n,a0=0,m,a5=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>m;
if(m==0) a0++;
else a5++;
}
if(a0&&a5-a5%9)
{
a5-=a5%9;
while(a5--)cout<<'5';
while(a0--) cout<<'0';
}
else if(a0) cout<<'0';
... | C++ | 409b27044d5ec97b5315c92d4112376f | 9659773816f00bd563b1ea9c7fb540da | 1,000 | PASSED |
import heapq
from collections import defaultdict
n,m = [int(x) for x in raw_input().split(' ')]
arr = list()
d = defaultdict(list)
for _ in range(m):
el = [int(x) for x in raw_input().split(' ')]
d[el[0]].append(el[1])
d[el[1]].append(el[0])
vis = []
cur = set()
q = []
heapq.heappush(q, 1)
cur.add(1)
whil... | Python | 157630371c4f6c3bcc6355d96c86a626 | 0b64c1cff94b4616efd1fad9436d405f | 1,500 | PASSED |
import heapq
n,m = [int(x) for x in raw_input().split(' ')]
arr = list()
for _ in range(m):
arr.append([int(x) for x in raw_input().split(' ')])
#n = int(raw_input())
d = dict()
for i in range(n):
d[i+1] = set()
for el in arr:
if el[0] == el[1]:
continue
d[el[0]].add(el[1])
d[el[1]].add(el... | Python | 157630371c4f6c3bcc6355d96c86a626 | d7cff8d5dca0d294c85df44274c61161 | 1,500 | PASSED |
import heapq
n, m = map(int, raw_input().split())
adj = [[] for i in range(n)]
for i in range(m):
x,y = map(int, raw_input().split())
adj[x - 1].append(y - 1)
adj[y - 1].append(x - 1)
adj = [sorted(i) for i in adj]
queue = [0]
moves = []
marked = {0}
while queue:
node = heapq.heappop(queue)
moves... | Python | 157630371c4f6c3bcc6355d96c86a626 | 3153406c63e35252c77b032cdf2f3095 | 1,500 | PASSED |
import heapq
from collections import defaultdict
d=defaultdict(list)
n,m=map(int,raw_input().split())
for i in range(m):
u,v=map(int,raw_input().split())
d[u].append(v)
d[v].append(u)
q=[1]
vis=[0]*(n+1)
vis[1]=1
while q:
x=heapq.heappop(q)
print x,
for i in d[x]:
if not vis[i]:
... | Python | 157630371c4f6c3bcc6355d96c86a626 | f4882346f0396ca1504acf2b3a96b6a5 | 1,500 | PASSED |
from sys import stdin
from collections import *
from heapq import *
rints = lambda: [int(x) for x in stdin.readline().split()]
class graph:
# initialize graph
def __init__(self, gdict=None):
if gdict is None:
gdict = defaultdict(list)
self.gdict, self.edges, self.l = gdict, [], de... | Python | 157630371c4f6c3bcc6355d96c86a626 | 03ea2cbf47c51546908fe60e5ab28df4 | 1,500 | PASSED |
"""Template for Python Competitive Programmers prepared by Mayank Chaudhary """
# to use the print and division function of Python3
from __future__ import division, print_function
"""value of mod"""
MOD = 998244353
mod = 10**9 + 7
"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x10... | Python | 157630371c4f6c3bcc6355d96c86a626 | d6a7ddb783951986a3d00966d963fbf8 | 1,500 | PASSED |
import sys, math
from sys import stdin, stdout
rem = 10**9+7
inf=10**18
sys.setrecursionlimit(10 ** 6 + 7)
#from resource import *; setrlimit(RLIMIT_STACK, (RLIM_INFINITY, RLIM_INFINITY))
take = lambda: map(int, stdin.readline().split())
from heapq import heappush, heappop, heapify
from collections import deque
from bi... | Python | 157630371c4f6c3bcc6355d96c86a626 | 0fb8d5ff8366804050bd87e987fc0713 | 1,500 | PASSED |
import sys
import heapq
n, m = [int(tmp) for tmp in sys.stdin.readline().split()]
lsc = [set() for tmp in range(n + 1)]
for i in range(m):
u, v = [int(tmp) for tmp in sys.stdin.readline().split()]
lsc[u].add(v)
lsc[v].add(u)
lms = [1] * n
lou = [0] * (n+1)
lou[1] = 2
myheap = []
for v in lsc[1]:
if ... | Python | 157630371c4f6c3bcc6355d96c86a626 | 3e873a228630449aeae21697388873b5 | 1,500 | PASSED |
import heapq
n,m = map(int,input().split())
dicto = {}
for i in range(m):
a,b = map(int,input().split())
if a in dicto:
dicto[a].append(b)
else:
dicto[a]=[b]
if b in dicto:
dicto[b].append(a)
else:
dicto[b]=[a]
visited = [0]*(n+1)
heap = [1]
visited[1]=1
while... | Python | 157630371c4f6c3bcc6355d96c86a626 | 868fdb5b61723952f6ee9364b81bd948 | 1,500 | PASSED |
import sys
import heapq
#sys.setrecursionlimit(200000)
input = sys.stdin.readline
n,m = map(int,input().split())
g = [[] for i in range(n)]
for i in range(m):
a,b = map(int,input().split())
a-=1;b-=1
g[a].append(b)
g[b].append(a)
que = [0]
heapq.heapify(que)
ans = []
used = [0]*n
for i i... | Python | 157630371c4f6c3bcc6355d96c86a626 | 4d661db6dca6bae3f1063c728b499bf0 | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int arr[123456];
long long pwer(int x)
{
long long r=1;
for(int i=0;i<x;i++) r*=2;
return r;
}
int main()
{
long n,mx=0;
cin.tie();
ios_base::sync_with_stdio(0);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr[i];
if(arr[i]>mx)... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | 518980ada4d98fb1906dedecc2bcdf2b | 1,900 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <limits>
#include <utility>
#include <iomanip>
#include <set>
#include <numeric>
#include <cas... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | ec06fdf366938ad24d54f207a4531bbd | 1,900 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
/*
ID: jamerz1
PROG: milk4
LANG: C++11
*/
// C++11
#include <tuple>
#include <chrono>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <array>
#include <iterator>
// C++03
#include <climits>
#include <cstring>
#include <algorithm>
... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | 874e3d849aecface060989d345c82133 | 1,900 | PASSED |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
/*
ID: jamerz1
PROG: milk4
LANG: C++11
*/
// C++11
#include <tuple>
#include <chrono>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <array>
#include <iterator>
// C++03
#include <climits>
#include <cstring>
#include <algorithm>
... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | a3dc7a794c8f81145a01dd90d2467474 | 1,900 | PASSED |
// Amr and Chemistry.cpp
#include <bits/stdc++.h>
#define LL long long
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI 3.1415926535897932626
#define EXIT exit(0);
#define PAUSE system("pause");
#define DEBUG puts("Here is a BUG");
#define SYNC_CLOSE ios::sync_with_stdio(false);
#define what_is(x) cout ... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | ff6fb7e956ae231fdec8272b5947f818 | 1,900 | PASSED |
// Amr and Chemistry.cpp
#include <bits/stdc++.h>
#define LL long long
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI 3.1415926535897932626
#define EXIT exit(0);
#define PAUSE system("pause");
#define DEBUG puts("Here is a BUG");
#define SYNC_CLOSE ios::sync_with_stdio(false);
#define what_is(x) cout ... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | d4880ff522a37cd76c0aec7220de751b | 1,900 | PASSED |
#pragma warning (disable : 4996)
#pragma comment(linker, "/STACK:36777216")
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <assert.h>
#include <stack>
#include <algorithm>
#include <ios>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <queue>
#include <set>
#i... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | cf61c2b27de7bb9b7224af6961e78512 | 1,900 | PASSED |
#include<bits/stdc++.h>
#define X first
#define Y second
#define eb push_back
#define siz(a) int(a.size())
#define endl "\n"
// compile :: g++ -Wall -std=c++0x -c "%f"
// build :: g++ -Wall -std=c++0x -o "%e" "%f"
#define trace2(x, y) cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define tr... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | ed992cc5d1cb71cf34219e9d50ba9ecd | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) a.begin() , a.end()
const int MAX = 100007;
int n;
int steps[MAX] , cnt[MAX] , vis[MAX];
void bfs(int src,int i){
queue<pair<int,int> > Q;
Q.push(mp(src,0));
while(!Q.empt... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | c72deab4b44346683f183f076ade0895 | 1,900 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define get(a) scanf("%lld", &a)
#define repVector(v) for( typeof(v.begin()) it = v.begin(); it != v.end(); it++ )
#define repSet(s) for( typeof(s.begin()) it = s.begin(); it != s.end(); it++ )
#define all(c) c.begin(), c.end()
#define MEM(a,b) memset(a,(b),sizeof(a))
#def... | C++ | bc1e2d9dba07b2ac6b0a118bdbdd063b | 2da1d7d8db5c6ff6916c09e913405e65 | 1,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 3e5 + 7;
int n, m;
vector<int>G[MaxN];
vector<int>S[MaxN];
int col[MaxN];
void DFS( int cur, int fa ) {
vector<int>vis;
for( int v:S[cur] ) {
if( col[v] ) vis.push_back(col[v]);
}
sort(vis.begin(),vis.end());
int c = 1,pos = 0;
for( int ... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 8d014e77a3e41b9f8a2ba7cd3df132ed | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 3e5 + 7;
int n, m;
vector<int>G[MaxN];
set<int>S[MaxN];
int col[MaxN];
void DFS( int cur, int fa ) {
vector<int>vis;
for( int v:S[cur] ) {
if( col[v] ) vis.push_back(col[v]);
}
sort(vis.begin(),vis.end());
int c = 1,pos = 0;
for( int v:S... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 81cedaca6d1bb2cfe2fb1b0c65fb5b03 | 2,200 | PASSED |
#include <iostream>
#include <iomanip>
#include <array>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <tuple>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#i... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | a72057ead75287beb51a82dd5cf76a6c | 2,200 | PASSED |
#include<bits/stdc++.h>
#define X first
#define Y second
#define eb push_back
#define pb pop_back
#define siz(a) int(a.size())
//for traversing the container (bcoz we cannot access linked list etc with direct index)
//c stands for container and it for iterator
#define tr(c, it) \
for(typeof(c.begin()) it=c.begin() ;... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 02b743f132b1cfc023c80a4ae5f76bc3 | 2,200 | PASSED |
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
using namespace std;
const int N = 3e5 + 5;
int n, m;
vector<int> types[N];
vector<int> a[N];
int coloring[N];
bool visited[N];
bool color_used[N];
void dfs(int u) {
visited[u] = true;
// colorin... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 618426b8da58cb28d82cf5d51db53f61 | 2,200 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
typedef pair<int, int> pii;
vector<int> G[maxn];
vector<int> s[maxn];
int color[maxn];
int c;
int n, m;
void dfs(int u, int fa) {
if(fa == -1)
for(int x : s[1]) {
color[x] = ++c;
}
else{
vector<int> exi;
for(int x : s[u]) {
if(colo... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 567660fe2ece80ff2c04d7855d46dbbf | 2,200 | PASSED |
#include "bits/stdc++.h"
using namespace std;
vector<int> Graph[300005] , Sets[300005] , Connected;
int Color[300005];
set<int> Used;
void Assign_Colors( int root , int Parent ){
int i , j = 1 , v;
set<int>::iterator it;
for( j = 0 ; j < Sets[root].size() ; j++ ){
v = Sets[root][j];
i... | C++ | 62241c11a5724d6c7e97a0892cd4f6fb | 2e001aebcac6d3aeecc4589c5aef4e75 | 2,200 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll d[100005],vis[100005],sz[100005],dp[100005][2],timer=1;
map<pair<ll,ll>,ll> st;
vector<vector<ll>> g,sum;
void dfs1(ll i,ll p,vector<vector<ll>> &v){
vis[i]=timer;
sz[timer-1]++;
for(ll j=0;j<v[i].size();j++)
if(v[i][j]!=p){
... | C++ | 475afda5d655ed090b296a1a1a1fca3c | dca338e3618e9d80a68b82e990439676 | 2,500 | PASSED |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <array>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#define sq(x) ... | C++ | 475afda5d655ed090b296a1a1a1fca3c | f881970a917a6a7a1aed9d8ccafbd1e8 | 2,500 | PASSED |
#include <algorithm> //STL 通用算法
#include <bitset> //STL 位集容器
#include <cctype> //字符处理
#include <cerrno> //定义错误码
#include <cfloat> //浮点数处理
#include <ciso646> //对应各种运算符的宏
#include <climits> //定义各种数据类型最值的常量
#include <clocale> //定义本地化函数
#include <cmath> //定义数学函数
#include <comple... | C++ | 475afda5d655ed090b296a1a1a1fca3c | fc641d7379714ae18c0fa79689d53dd4 | 2,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pib = pair<int,bool>;
using ll = long long;
using ld = long double;
#define all(x) (x).begin(),(x).end()
#ifdef fread_unlocked
#define fread fread_unlocked
#define fwrite fwrite_unlocked
#endif
#define lc ind<<1
#define rc ind<<1|1
const int... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 241a3482badcdf58e5d4a59c241a5f0e | 2,500 | PASSED |
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#d... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 161f9885050e01b29621f6a4b988c7a5 | 2,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*vector<int> vec[300010],edge[300010],col[300010],tot[300010];
int fa[300010],ans[300010];
int getfa(int i){
if(fa[i]!=i)
return fa[i]=getfa(fa[i]);
else
return fa[i];
}
void uni(int a,int b){
getfa(a);
getfa(b);
fa[fa[a]]=fa[b];
}
int main(){... | C++ | 475afda5d655ed090b296a1a1a1fca3c | b4cd7f0eb6991615f50c81807f172cc3 | 2,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
long long cnt = 0;
vector<long long> graph[300001],com[300009],sx[300009];
long long vis[300009],dis[300009][3],dia[300009];
map<pair<long long,long long>, double> ans;
pair<long long,long long> find_far(long long v,long long p)
{
pair<long long,long long> temp,ret;
ret ... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 9a0eee726ec723610a998810f81cd90d | 2,500 | PASSED |
#include<bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define forab(i, a, b) for (int i = (a); i <= (b); i++)
#define forba(i, b, a) for (int i = (b); i >= (a); i--)
#define mset(a, n) memset(a, n, sizeof(a))
#define endl '\n'
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namesp... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 87e3c61477735559cb246340fa64691e | 2,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 1e5 + 2;
vector<int> g[maxn];
vector<ll> c[maxn], acum[maxn];
int n, m, q, idx, comp[maxn];
ll d[maxn], dist[maxn];
map<pii, ll> memo;
vector<int> cur;
void dfs(int node, int par){
... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 1842942601bceb17fbd93a859d148617 | 2,500 | PASSED |
#include<bits/stdc++.h>
#define REP(i,j,k) for(int i=j;i<k;++i)
#define RREP(i,j,k) for(int i=(int)j-1;i>=k;--i)
#define int long long
#define pb emplace_back
#define P pair<int,int>
#define F first
#define ALL(x) x.begin(),x.end()
#define sz(a) (int)(a).size()
#define MX 100005
#define oo 1e18
#define L d*2
#define R ... | C++ | 475afda5d655ed090b296a1a1a1fca3c | 67db2b3252fb9f24ed08bcb50b9b303b | 2,500 | PASSED |
#include<bits/stdc++.h>
#define mid ((l+r)>>1)
using namespace std;
struct node
{
int num,flag,lson,rson;
node()
{
flag=-1;
lson=rson=0;
}
}t[15000005];
int tot=0,root,n,q;
inline void up(int now)
{
t[now].num=t[t[now].lson].num+t[t[now].rson].num;
}
inline void down(int now,int l,in... | C++ | cfdf92a1cc9915db11811678fac35771 | 83e3266783dbd8a19b588ad212cc0549 | 2,300 | PASSED |
#include<bits/stdc++.h>
#define R register
#define IT set<node>::iterator
using namespace std;
int n,m,res;
struct node {
int l,r;
mutable bool v;
node(int _l,int _r = -1,int _v = 0) : l(_l),r(_r),v(_v) {}
bool operator < (const node &o) const {
return l < o.l;
}
};
set<node> s;
IT split(int pos) {
IT it = s... | C++ | cfdf92a1cc9915db11811678fac35771 | 43c4fcaeb31e1e1f900fce15df86062c | 2,300 | PASSED |
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int maxn = 15001000;
int n,m,tot;
struct node
{
int l,r,sum,tag;
}tree[maxn];
int build()
{
tot++;
tree[tot].l = tree[tot].r = tree[tot].sum = 0;
tree[tot].tag = -1;
return tot;
}
void spread(int now,int l,int ... | C++ | cfdf92a1cc9915db11811678fac35771 | 300cf61e0019a2c908c89435551bacf7 | 2,300 | PASSED |
/*Code by 520 -- 9.25*/
#include<bits/stdc++.h>
#define il inline
#define ll long long
#define RE register
#define For(i,a,b) for(RE int (i)=(a);(i)<=(b);(i)++)
#define Bor(i,a,b) for(RE int (i)=(b);(i)>=(a);(i)--)
using namespace std;
const int N=300005;
int n,m,root,cnt;
int ls[N*50],rs[N*50],sum[N*50],lazy[N*50];
i... | C++ | cfdf92a1cc9915db11811678fac35771 | 553aac25a6e082a611035baed10d623c | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,q,l,r,k,tot=0,ls[15000010],rs[15000010],tree[15000010],tag[15000010];
inline int read()
{
int ans=0,f=1;
char ch;
ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){ans=ans*10+ch-'0';ch=getchar();}
return ans*f;
}
i... | C++ | cfdf92a1cc9915db11811678fac35771 | ee0362ad27408a9bf2c42f292ecd85ad | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri register int
const int N=3e5+5;
struct ly{
int ls,rs,sum,flag;
#define ls(p) tr[p].ls
#define rs(p) tr[p].rs
#define s(p) tr[p].sum
#define fl(p) tr[p].flag
}tr[N*50];
int cnt=1;
template<typename dr>void read(dr &a){
dr x=0,f=1;char ch=getchar();
for(;!is... | C++ | cfdf92a1cc9915db11811678fac35771 | 458a137aa4fdbb2220e942ef263b6365 | 2,300 | PASSED |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
using namespace std;
#define S_IT set<Node>::iterator
struct Node
{
int l, r;
mutable bool val;
Node(int a, int b = -1, bool v = false) :l(a), r(b), val(v) {}
bool operator <(const Node &a) const
{
retu... | C++ | cfdf92a1cc9915db11811678fac35771 | 0496ca2337e797643a9b1df05860bf88 | 2,300 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int n,q,l,r,k,tot,rt,sum[300010*50],ls[300010*50],rs[300010*50],lazy[300010*50];
void insert(int &son)
{
if(!son)son=++tot;
}
void push_down(int p,int l1,int r1)
{
if(!lazy[p])return;
int k=lazy[p]-1,mid=(l1+r1)/2;
insert(ls[p]);
sum[ls[p]]=k*(mid-l1+1);
... | C++ | cfdf92a1cc9915db11811678fac35771 | fe7995d73c8b4b57d96b08900dea19df | 2,300 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
inline long read(){
long re=0;
char ch=getchar();
while(ch<'0'||ch>'9'){
ch=getchar();
}
while(ch>='0'&&ch<='9'){
re=(re*10+ch-'0');
ch=getchar();
}
return re;
}
long n,m;
long cnt;
long rot;
struct node{
long sum,l,r;
}tree[1500... | C++ | cfdf92a1cc9915db11811678fac35771 | 6e55a46504824c7e4e360689b6b5e1f0 | 2,300 | PASSED |
#include<bits/stdc++.h>
#define N 300000
using namespace std;
int n,q,tot,v[N*50],lson[N*50],rson[N*50],f[N*50],rt;
void insert(int &k){
if(!k) {
k=++tot;
v[k]=0;
}
}
void push_up(int k){
v[k]=v[lson[k]]+v[rson[k]];
}
void push_down(int k,int l,int r){
if(!f[k]) return;
if(!lson[k]) lson[k]=++tot;
if(!rs... | C++ | cfdf92a1cc9915db11811678fac35771 | 799df6e3c6f66a20475609ef58cd6291 | 2,300 | PASSED |
var firstLine = +readline();
var secondLine = readline().split(' ').map(function(v){return +v;});
var stairsCount = firstLine;
var strairs = secondLine;
var result = [];
var temp = 0;
for (var i = 1; i < stairsCount; i++) {
if (strairs[i] === 1) {
if (result.length > 0) {
result.push(i - temp)... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | d3ee9eea5b00ce17395c9e938a12e882 | 800 | PASSED |
var numbers = +readline();
var steps = readline().split(' ').map(Number);
if (numbers === 1) {
print(1);
print(1);
} else {
var stepsStairway = [];
for (var i = 1; i < numbers; i++) {
if (steps[i] === 1) {
stepsStairway.push(steps[i - 1]);
}
}
stepsStairway.push(ste... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | b462213af88c13fcad5ef492e2bed3e5 | 800 | PASSED |
var n = readline();
var arr = readline().split(' ').map(Number);
var start = 0;
var count = 0;
var result = [];
for (var i=1; i<n; i++) {
if (arr[i] <= arr[i-1]) {
count++;
result.push(i - start);
start = i;
}
}
count++;
result.push(n - start);
print(count);
print(result.join(" ")); //... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | 8ddbc3b8523b9e226259416f95ad0c73 | 800 | PASSED |
/*
n = +readline();
a = readline().split(" ").map(Number);
var res = 0 , add = 0;
for (i = 0 ; i < n ; i ++){
a[i] -= add;
add += a[i];
res += Math.abs(a[i]);
}
write(res);
*/
n = +readline();
a = readline().split(' ').map(Number);
var res = 0;
for (var i = 0 ; i < n ; i ++)
{
if (a[i] == 1){
... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | 6e2c8057da4b36ae6f813ad79eba3ede | 800 | PASSED |
const n = readline();
var arr = readline().split(' ').map(function(v){return +v;});
var start = 0;
var count = 0;
var result = [];
for (var i=1; i<n; i++) {
if (arr[i] <= arr[i-1]) {
count++;
result.push(i - start);
start = i;
}
}
count++;
result.push(n - start);
print(count);
print(r... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | eb0a881e531712f5bb51a7285e4acd87 | 800 | PASSED |
var last = 1,
floor = [];
var total = +readline();
if (total == 1) {
write(1 + '\n' + 1);
} else {
readline().split(' ').forEach((step, index) => {
if( index ) {
if(parseInt(step) == 1) floor.push(last);
if( index == total - 1) floor.push(step)
last = parseInt(step); }
... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | e01bed30a37308b128f717d2f605c4ea | 800 | PASSED |
var n = +readline();
var a = readline().split(' ').map(Number);
var les = 0;
var j = -1;
var b = [];
for (var i=0; i<n; i++){
if (a[i] == 1) {
les++;
j++;
b[j] = 1;
} else b[j]++;
}
print (les);
print (b.join(' ')); | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | b67cd82beb04417a90a22b1a9ce9e3b4 | 800 | PASSED |
var line1 = readline().split(" ").map(function (x) { return parseInt(x); });
var line2 = readline().split(" ").map(function (x) { return parseInt(x); });
var stairs = [];
var stairsIndex = -1;
for (index = 0; index < line2.length; index++) {
var line_2number = line2[index];
if (line_2number == "1") {
s... | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | 7102cca76e080d9dbb2f4c0834cd0630 | 800 | PASSED |
var g = readline();
var k = readline().split(" ");
var lens_arr = [1];
var len_count = 1;
for(i=1,b=0;i<k.length;i++){
if(k[i]==1){
len_count++;
b++;
lens_arr[b] = 1;
}else{
lens_arr[b]++;
}
}
print(len_count);
print(lens_arr.join(" ")); | Javascript | 0ee86e75ff7a47a711c9eb41b34ad1a5 | ed280c7a7403f9177b6e8b42244c1973 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,x=0,ans=0;
cin>>n;
int a[n+5],ans1[n+5],f=1;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]==1 && i-1!=0)
{
ans++;
ans1[f]=x;
f++;
x=0;
x++;
}
else{
x++;
}
if(i==n)
{
ans++;
ans1[f]=x;
f++;
}
}
cout<<ans<<en... | C++ | 0ee86e75ff7a47a711c9eb41b34ad1a5 | 90ebfc26f07e896e5d0bd6acbef5c6a8 | 800 | PASSED |
#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
vector<int> v[105];
int found = 0;
bool f[105];
int c[105];
int csz = 0;
stack<int> st;
void foundCycle( int x , int p )
{
f[x] = true;
st.push( x );
for ( int i=0 ; i<v[x].size() ; i++ )
{... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | 9054490a54b9cabc91c30fa1fe6c481e | 1,500 | PASSED |
#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
vector<int> v[105];
bool f[105];
void dfs( int x )
{
f[x] = true;
for ( int i=0 ; i<v[x].size() ; i++ )
{
int y = v[x][i];
if ( f[y] == false )
dfs( y );
}
}
int main() // idea f... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | e78f21bc2c9b11bbf2582c5009f8ad8a | 1,500 | PASSED |
#include <bits/stdc++.h>
#define FOR(i,x,n) for(ll i=x;i<n;i++)
#define rFOR(i,x,n) for(ll i=x;i>n;i--)
#define SZ(x) (int)x.size()
const int MaxSize=1e2+5;
typedef long long ll;
using namespace std;
int n,m;
bool Edge[MaxSize][MaxSize];
bool Node[MaxSize];
void DFS(int cur)
{
if(Node[cur])
return;
... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | ae5120faa571c81da1e486c45af63003 | 1,500 | PASSED |
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>
using namespace std;
map<int, set<int>> graph;
bool seen[101], fit;
int n, m;
set<int> cycle;
bool ex[101] = { 0 };
bool f = false, s = false;
int findCycle(int p, int i) {
ex[i] = true;
if (seen[i]) {
cycle.... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | a0a5a8408ac012ce9a86050ead16a6fd | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G;
bool vis[200];
bool cycle[200][200];
int ans = 0;
void dfs(int i, int par)
{
vis[i] = 1;
for (int j=0;j<G[i].size();j++)
{
if (!vis[G[i][j]])
dfs(G[i][j], i);
else if (!cycle[i][G[i][j]] && G[i][j] != par)
ans++, cycle[i][G[i][j]] = cyc... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | fe1066ab9b95adf967e9e24a094c8787 | 1,500 | PASSED |
//////////////////////////////////////////////////////////////////
////////////////// Sa1378 Platform Vesion 1.2.6 /////////////////
////////////////////////////////////////////////////////////////
// Yesterday is history...
// Tomorrow is a mystery...
// But Today is a GIFT.
#include <bits/stdc++.h>
using namespac... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | 5af5653207ded8dbc12665639ca2b0ee | 1,500 | PASSED |
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<unordered_map>
#include<vector>
#include<queue>
#include<numeric>
#include<cmath>
#include<set>
#include<map>
#if DEBUG && !ONLINE_JUDGE
#include "debugger.cpp"
#else
#define debug(args...)
#define printMatrix(args...)
#define... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | 012a8c0b0a97a4b21b457ae6b8ba179e | 1,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
//UNION FIND
#define REP(i, a, b) for (int i = int(a); i <= int(b); i++)
vector<int> pset(1000); // 1000 is just an initial number, it is user-adjustable.
void initSet(int _size) {
pset.resize(_size); REP (i, 0, _size - 1) pset[i] = i;
}
int findSet(int i) {
return (pset... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | b3aebf5b1569c84326599a7b054cca17 | 1,500 | PASSED |
//Bismillah
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,begin,end) for (ll i=begin;i<=end;i++)
#define rep(i,t) for (ll i=0;i<t;i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
int n,m;
bool mark[1100];
vector <int> a[1100];
void dfs(int u)
{
mark[u] = true;
rep(j,a[u].size()... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | ec96a5d9be555fc1108d007fe678201d | 1,500 | PASSED |
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author Abdelraoof Hosam
*/
#include <bits/stdc++.h>
using namespace std;
#define WHITE -1
#define BLACK 1
class TaskC {
public:
int n, m;
vector< vector<int> > v;
vector<int> vis;
void dfs(int u) {
i... | C++ | 4ecbfc792da55f458342c6eff2d5da5a | 7d3b7862a6fc84bb43160e416206ae41 | 1,500 | PASSED |
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
long long x,y,p,q;
bool check(long long mid)
{
if(q*mid<y) return false;
long long res=q*mid-y;
if(res>=p*mid-x && p*mid>=x) return true;
return false;
}
int main()
{
int T;
cin>>T;
while(T--)
... | C++ | 589f3f7366d1e0f9185ed0926f5a10bb | e74af7cf7c1453e85b00d740895f6f7f | 1,700 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.