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
import java.util.*; public class Problem1750F { static long[] dp_sum2=new long[5001];/*dp_sum2[k] = sum from dp_sum[1][k] to dp_sum[k][1], where dp_sum[i][j]=dp_sum[i][i] when j>i*/ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long mod=sc.nextIn...
Java
4840c4ddf8d9ca82c6e8fcf71802539a
23ca53050d215252cdda52ad0fc027e7
2,700
PASSED
import java.util.*; public class Problem1750F { static long[] dp_sum2=new long[5001]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long mod=sc.nextInt(); long[][] dp=new long[n+1][n+1]; long[][] dp_sum=new long[n+1][n+1]; dp[1][1]=1; dp_...
Java
4840c4ddf8d9ca82c6e8fcf71802539a
8cbc67d743f199bdad3503866182c54c
2,700
PASSED
// #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #include <immintrin.h> using namespace std; #define ll long long #define flt double #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define prcs cout << fixed << setprecision(10) #define l...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
9699267a4034f7e0d92ee89bcecd2c14
2,700
PASSED
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(a) begin(a), end(a) #define len(a) int((a).size()) #ifdef LOCAL #include "debug.h" #else #define dbg(...) #define dprint(...) #endif // LOCAL template<...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
79ab65f4f3a106c20f193272c78abff6
2,700
PASSED
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define all(a) begin(a), end(a) #define len(a) int((a).size()) #ifdef LOCAL #include "debug.h" #else #define dbg(...) #define dprint(...) #endif // LOCAL template<...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
8d6eac3085f7e429e6950619f5b74131
2,700
PASSED
// ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙ // ➡ @roadfromroi ⬅ // ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖ #include <iostream> #include "vector" #include "algorithm" #include "numeric" #include "climits" #include "iomanip" #include "bitset" #include "cmath" #include "map" #include "deque" #include "array" #include "set" #define all(x) x.begin(), x.end()...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
415663e5e1228ddbdbe1f970e25a40d6
2,700
PASSED
// ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙ // ➡ @roadfromroi ⬅ // ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖ #include <iostream> #include "vector" #include "algorithm" #include "numeric" #include "climits" #include "iomanip" #include "bitset" #include "cmath" #include "map" #include "deque" #include "array" #include "set" #define all(x) x.begin(), x.end()...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
ba4d3263da3f7ce6797c635d91984a46
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define N 5005 int n,mod; int f[N][N]; int ans[N],g[N+N]; int qpow(int x,int y){ int t=1; for(;y;y>>=1){ if(y&1)t=1LL*t*x%mod; x=1LL*x*x%mod; } return t; } int main(){ int i,j,k; scanf("%d%d",&n,&mod); for(i=1;i<=n...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
8b09d5acf7a57280da8342704909173e
2,700
PASSED
#pragma GCC optimize ("O3", "unroll-loops") // #pragma GCC target ("avx2") // #pragma comment(linker, "/stack:200000000") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> #include<iostream> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin()...
C++
4840c4ddf8d9ca82c6e8fcf71802539a
0d86983413c939644b8719911790eec3
2,700
PASSED
#pragma GCC optimize("O3","unroll-loops") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; #define int long long const int maxn=5e3+5; int fact[maxn]; int c[maxn][maxn]; int answ[maxn]; bool used[maxn]; bool used1[maxn]; int res[maxn];int res1[maxn];int res2[maxn]; int c1(int n,int...
C++
bc0089608493d9160eefb769e5c87475
c55ab682e82a50fe9a95207a882ce96e
3,300
PASSED
#pragma GCC optimize("O3","unroll-loops") #pragma GCC target("avx2") #include <bits/stdc++.h> using namespace std; #define int long long const int maxn=5e3+5; int fact[maxn]; int c[maxn][maxn]; int answ[maxn]; bool used[maxn]; bool used1[maxn]; int res[maxn];int res1[maxn];int res2[maxn]; int c1(int n,int...
C++
bc0089608493d9160eefb769e5c87475
76b9642c068615f7b019e6bab9b15839
3,300
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' mt19937_64 rnd(0); const int N=2010; ll mod; ll binpow(ll a,ll b){ if (!b) return 1; if (b%2) return binpow(a,b-1)*a%mod; else return binpow(a*a%mod,b/2ll...
C++
bc0089608493d9160eefb769e5c87475
e38ae7f4aa6c00fc3de59b51ae22fbb8
3,300
PASSED
#pragma GCC optimize("Ofast") #pragma GCC target("avx2") #include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' mt19937_64 rnd(0); const int N=2010; ll mod; ll binpow(ll a,ll b){ if (!b) return 1; if (b%2) return binpow(a,b-1)*a%mod; else return binpow(a*a%mod,b/2ll...
C++
bc0089608493d9160eefb769e5c87475
4fc911936b24c4a2dda5dd53ac3bdba7
3,300
PASSED
#include <bits/stdc++.h> #ifdef ALGO #include "el_psy_congroo.hpp" #else #define DUMP(...) #define PLOT(...) #define CHECK(...) #endif namespace { using LL = long long; template<typename T, typename U> bool enlarge(T& a, U b) { \ return a < b ? (a = b, true) : false; } template<typename T, typename U> bool minify(T...
C++
bc0089608493d9160eefb769e5c87475
5fe6fa2b9f204a725d484781c59ead45
3,300
PASSED
#include<iostream> #include<cstdio> #define N 2000 using namespace std; int read() { char c=0; int sum=0; while (c<'0'||c>'9') c=getchar(); while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar(); return sum; } int n,m,cnt0,cnt1,cnts,rcnt0,rcnt1,rcnts,rcnt,fac[N+1],C[N+1][N+1],p[N+1],DP[N+1]...
C++
bc0089608493d9160eefb769e5c87475
2f8fb7e46eb045ba477b290c244fab4b
3,300
PASSED
#include<iostream> #define rep(i,a,b) for(int i = (a); i <= (b); i++) #define per(i,b,a) for(int i = (b); i >= (a); i--) #define N 2022 #define ll long long using namespace std; int n, mod, p[N]; ll dp[N][N], C[N][N], fact[N]; ll f[N], g[N]; bool vis[N]; int main(){ cin>>n>>mod; rep(i,1,n) cin>>...
C++
bc0089608493d9160eefb769e5c87475
90210d5b76a8d91cc80388a33000e0e7
3,300
PASSED
#ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <...
C++
bc0089608493d9160eefb769e5c87475
ac0f78f40d7863c595fff252b3f08034
3,300
PASSED
// LUOGU_RID: 93280942 /* ¤ï¤ó¤ï¤ó¡­¡­¤ï¤ó¤À¤Û©`¤¤¤Ã¡î Wonderhoy! */ #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef double DB; char buf[1<<21],*p1=buf,*p2=buf; #define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<18,stdin),p1==p2)?EOF:*p1++) int read() { int x=0; char c=ge...
C++
bc0089608493d9160eefb769e5c87475
34383cd6dee45fcc28b420cf51d3a503
3,300
PASSED
/* ¤ï¤ó¤ï¤ó¡­¡­¤ï¤ó¤À¤Û©`¤¤¤Ã¡î Wonderhoy! */ #include<bits/stdc++.h> using namespace std; typedef long long LL; typedef double DB; char buf[1<<21],*p1=buf,*p2=buf; #define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,1<<18,stdin),p1==p2)?EOF:*p1++) int read() { int x=0; char c=getchar(); while(c<'0' ...
C++
bc0089608493d9160eefb769e5c87475
38c3ce7a1a9e37ad51e3df71409dc6a4
3,300
PASSED
#include <stdio.h> #include <stdlib.h> #define N 200000 #define N_ (1 << 18) /* N_ = pow2(ceil(log2(N + 1))) */ int *el[N], elo[N], *er[N], ero[N]; void append(int **ej, int *eo, int i, int j) { int o = eo[i]++; if (o >= 2 && (o & o - 1) == 0) ej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]); ej[i][o] = j...
C
ca819658b7abe14aba2a66f9c171b342
374d4bc9ce9e828c0e0eab51cc47d122
3,500
PASSED
#include <iostream> #include <cstdio> #include <vector> #define ll long long using namespace std; int t,n,len[200005]; char s[200005]; int mx[524288]; void build(int now,int nowl,int nowr){ if (nowl==nowr){ mx[now]=0; if (s[nowl]=='0'&&(nowl==n||s[nowl+1]=='1'))mx[now]=nowl+len[nowl]; return; } i...
C++
ca819658b7abe14aba2a66f9c171b342
44cbebd5a8cc1c667414a0b4890bc680
3,500
PASSED
#include <iostream> #include <cstdio> #include <vector> #define ll long long using namespace std; int t,n,len[200005]; char s[200005]; int mx[524288]; void build(int now,int nowl,int nowr){ if (nowl==nowr){ mx[now]=0; if (s[nowl]=='0'&&(nowl==n||s[nowl+1]=='1'))mx[now]=nowl+len[nowl]; return; } i...
C++
ca819658b7abe14aba2a66f9c171b342
40598f8723cfe1e9bffe3fba5fc4824f
3,500
PASSED
#include <bits/stdc++.h> #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> ...
C++
ca819658b7abe14aba2a66f9c171b342
28831e627e05c3f5a2c17ba9db29993d
3,500
PASSED
#include <bits/stdc++.h> #include <iostream> #include <math.h> #include <cstdio> #include <vector> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int random(int st, int dr) { uniform_int_distribution<mt19937::result_type> gen(st, dr); return gen(rng); } vect...
C++
ca819658b7abe14aba2a66f9c171b342
3d8585c1bde9113279378e6fd16637c7
3,500
PASSED
#include<bits/stdc++.h> using namespace std; struct node{ int x,y; }g[200011]; struct query{ int x,y,c,idx; }q[1000011]; int n,m,cnt,gl[200011],gr[200011],t[1000011],la[1000011],px[200011],py[200011],idxl[200011],idxr[200011],sum,ss[500011]; long long ans; char ch[200011]; vector<node> pl[200011],pr[200011...
C++
ca819658b7abe14aba2a66f9c171b342
583a4b74362f18095f3c4cfecc45efb3
3,500
PASSED
#include <stdio.h> #include <stdlib.h> #define N 200000 #define N_ (1 << 18) /* N_ = pow2(ceil(log2(N + 1))) */ int *el[N], elo[N], *er[N], ero[N]; void append(int **ej, int *eo, int i, int j) { int o = eo[i]++; if (o >= 2 && (o & o - 1) == 0) ej[i] = (int *) realloc(ej[i], o * 2 * sizeof *ej[i]); ej[i][o] = j...
C++
ca819658b7abe14aba2a66f9c171b342
4bae12deaa9722761c55fae3c300245c
3,500
PASSED
#include <bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int random(int st, int dr) { uniform_int_distribution<mt19937::result_type> gen(st, dr); return gen(rng); } vector<int> lg; struct bit { vector<int> b; void resize(int n) { b...
C++
ca819658b7abe14aba2a66f9c171b342
7c2dcded8e28096847396846c2c70b3b
3,500
PASSED
// LUOGU_RID: 93525431 # include <bitset> # include <cstdlib> # include <functional> # include <initializer_list> # include <tuple> # include <utility> # include <cfloat> # include <climits> # include <cassert> # include <cctype> # include <cstring> # include <string> # include <deque> # include <forward_l...
C++
ca819658b7abe14aba2a66f9c171b342
9a187d488f4023fced01f1774487a980
3,500
PASSED
//I am the second person who got AC ez #include <bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int random(int st, int dr) { uniform_int_distribution<mt19937::result_type> gen(st, dr); return gen(rng); } vector<int> lg; struct bit { vector<i...
C++
ca819658b7abe14aba2a66f9c171b342
449fa320760ac04b472ce2e43fa4461e
3,500
PASSED
#include <bits\stdc++.h> #include <iostream> using namespace std; const int N = 2e5 +10; int a[N]; void solve(){ priority_queue<pair<int, int> >pq; map<int, int> mp; int n; cin >> n; for(int i = 1; i <= n; i ++){ int x; cin >> x; mp[x] ++; } for(auto [x, y] : mp){ ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
62b1520778b84b935ff869f86f230dcd
1,400
PASSED
#include <bits/stdc++.h> #include <unordered_map> using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; #define pb push_back #define pob pop_back #define ff first #define ss second #define all(v) (v).begin(), (v).end() #define sare(v) (v).begin(), (v).end() #def...
C++
c67c376c8dcb3b3901eaf45fc50cc752
248c3e9c8d92de043ff5e6a7715e6e94
1,400
PASSED
#include "bits/stdc++.h" using namespace std; using ll = long long; const int MAX_N = 2e5 + 9; int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0); int t; cin >> t; while(t--){ int n , ans; cin >> n; ans = n; map<int,int>mp; priority_queue<pair<int,int>>pq; for(int i = 0 ,x; i < n ; i++) ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
35d1c0b65f31ee7a9fb8c76344c39d94
1,400
PASSED
#include<bits/stdc++.h> using namespace std; int main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); int t; cin >> t; while(t--){ int n; cin >> n; map<int, int> m; for(int i=0; i<n; ++i){ int a; cin >> a; m[a]=m[a]+1; } ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
4cda24bb87e6f325da0f0f288a183eae
1,400
PASSED
// Problem: F - 衬衫的价格是九磅十五便士 // Contest: Virtual Judge - 苏州大学acm集训队21级第二场排位赛 // URL: https://vjudge.net/contest/487356#problem/F //jiayang and chenggeng bless my code without bugs #include<bits/stdc++.h> #define pii pair <int, int> #define pll pair <ll, ll> #define rep(i,a,n) for (int i=a;i<=n;i++) #define per(i,a,n) ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
1f670c1dae49a1710a76c2887db895ba
1,400
PASSED
//Author: Fuadul Hasan(fuadul202@gmail.com) //BSMRSTU,Gopalganj #include<bits/stdc++.h> using namespace std; //debug.......... #define error(args...) {vector<string>_v=split(#args,',');err(_v.begin(),args);cout<<endl;} vector<string> split(const string &s, char c) {vector<string>v; stringstream ss(s); string x;while (...
C++
c67c376c8dcb3b3901eaf45fc50cc752
09f129e21c8751080997e8e1fecda007
1,400
PASSED
#include <iostream> #include<vector> #include<cmath> #include<cstring> #include<algorithm> using namespace std; #define ll long long const int N=2e5+10; int a[N]; int main() { ios::sync_with_stdio(false); int t,ans=0,j; cin>>t; while(t--){ int n,ans=0,maxx=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
c8a353c10d7ccad67ba174b3f5b751de
1,400
PASSED
#include<stdio.h> #include<string.h> #include<map> using namespace std; typedef long long ll; int max(int a,int b){ return a>b; } int main(){ int t; scanf("%d",&t); while(t--){ ll n; scanf("%lld",&n); map<ll ,ll>mp; ll i,j; ll x;ll max=0; for(i=1;i<=n;i++){ scanf("%lld",&x); mp[x]+=1; if(mp[x]>...
C++
c67c376c8dcb3b3901eaf45fc50cc752
d68182f3f170df85a7c4f528f42af068
1,400
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; void solve() { int t; cin >> t; while (t--) { ll n, ans = 0; vector<ll> v; map<ll, ll> m; cin >> n; for (int i = 0; i < n; i++) { ll x; cin >> x; m[x]++; ...
C++
c67c376c8dcb3b3901eaf45fc50cc752
019ca41ab75fc842e2da2943aa11a2ad
1,400
PASSED
#include<iostream> #include<algorithm> using namespace std; const int N=200100; int a[N]; int main() { int t; cin>>t; while(t--) { int n,mx=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } sort(a+1,a+1+n); int now=a[1],num=0; for...
C++
c67c376c8dcb3b3901eaf45fc50cc752
906087a0c74c9dc93367cf62ab39397e
1,400
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; vector<int> p(n); for(int i = 0; i < n; i++) { cin >> p[i]; } set<int> mns, mxs; for(int i = 1; i <= n...
C++
6e7b8742906ce40458d920121c33c54f
710a9d09562fabe8af45e7aaaa40f331
1,500
PASSED
#include<iostream> #include<cstring> #include<cstdio> #include<queue> #include<map> #include<set> #include<vector> #include<algorithm> #include<string> #include<bitset> #include<cmath> #include<array> #include<atomic> #include<sstream> #include<stack> //#define int ll #define pb push_back #define endl '\n' #define x f...
C++
6e7b8742906ce40458d920121c33c54f
cc0eb081b60ef64847c08c8574daa405
1,500
PASSED
#include <bits/stdc++.h> #define int long long #define endl '\n' using namespace std; const int N = 2e5 + 10; int w[N], n, f[N]; bool st[N]; int find(int a) { if (a != f[a]) f[a] = find(f[a]); return f[a]; } signed main() { ios::sync_with_stdio(0); int T; cin >> T; while (T--) { cin >> n; for (int i =...
C++
6e7b8742906ce40458d920121c33c54f
2662e653a087576cf9ad573e96876ce8
1,500
PASSED
#include <bits/stdc++.h> #define ll long long #define endl "\n" #define fastio(); ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define fi first #define se second using namespace std; bool pake[200001]; int t, n; int arr[200001]; vector<int> v; int main (){ cin >> t; while (t--){ ...
C++
6e7b8742906ce40458d920121c33c54f
c6a03e7e2a17a38149f4a7f1d516086c
1,500
PASSED
#include <bits/stdc++.h> using namespace std; const int N=2e5+7; int a[N]={},b[N],minn[N],maxn[N]; int main(){ ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0); int t,n; cin>>t; for(int j=0;j<t;j++){ cin>>n; int k=1; for(int i=0;i<n;i++){ cin>>a[i]; b[i...
C++
6e7b8742906ce40458d920121c33c54f
3d252a793391cfa569643957d9b6ca9b
1,500
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2*1e5+10; int s[N]; bool mp[N]; int v[N]; int p[N]; int main(){ ios::sync_with_stdio(false); int t,n; cin>>t; while(t--){ queue<int>q; set<int>se; cin>>n; memset(mp,0,sizeof(mp)); for(int i=1;i<=n;i++){ ...
C++
6e7b8742906ce40458d920121c33c54f
4c4f75aab7b4b6c9f8198d2acd59e5e1
1,500
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1e5; int n; int main() { int t; cin >> t; while(t--){ cin >> n; int arr[n+10]; map<int,int>mp; for(int i = 1; i <= n; ++i) {cin >> arr[i]; mp[arr[i]]++; } vector<int>v,vr; for(int i=1; i<=n ;i++) ...
C++
6e7b8742906ce40458d920121c33c54f
eaa6d657bf68f75a22c0c2d6f76a458b
1,500
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long int main() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { int n; cin >> n; vector<int>a...
C++
6e7b8742906ce40458d920121c33c54f
0b47bf5bc5757775da756c492e7a504c
1,500
PASSED
#include<bits/stdc++.h> using namespace std; #define go std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL) int main() { go; int t=0; cin>>t; while(t--) { int n=0; cin>>n; set<int>s1,s2; for(int i=1;i<=n;i++) { s1.insert(i); s2.insert(i); } vector<int>v(n),v1(n),v2(n); for(auto &x:v)cin>>x; for(...
C++
6e7b8742906ce40458d920121c33c54f
695b6353f6cf22b609713a1be778569e
1,500
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define pb push_back #define mp make_pair #define F first #define S second #define ld long double #define pii pair <int, int> #define sz(a) (int)(a.size()) #define resize(v) v.resize(unique(all(v)) - v.begin()); #d...
C++
6e7b8742906ce40458d920121c33c54f
ad071182df501770b16a333f7c759ffe
1,500
PASSED
#include<bits/stdc++.h> using namespace std; long long solution(vector<long long> a){ long long n = a[0]; // hang = 3 long long m = a[1]; // cot = 5 long long x = a[2]; // value = o x; long long cot = 0; long long hang = 0; //tinh cot; if(x % n == 0){ cot += x / n; }...
C++
e519e4495c9acef4c4a614aef73cb322
026229b8e45caabdb67ebe1717f36b82
800
PASSED
#include <bits/stdc++.h> #define mod (10e9 + 7) #define ll long long int #define llc long long char using namespace std; int as(const void *a, const void *s) { return *(char *)s - *(char *)a; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); ll xx; cin >> xx; // cin.ignor...
C++
e519e4495c9acef4c4a614aef73cb322
5d83cb35e4b8c26c09f17546076e542b
800
PASSED
#include <bits/stdc++.h> #define mod (10e9 + 7) #define ll long long int #define llc long long char using namespace std; int as(const void *a, const void *s) { return *(char *)s - *(char *)a; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); ll xx; cin >> xx; // cin.ignor...
C++
e519e4495c9acef4c4a614aef73cb322
39d8d608dc54e4de90f5f789ff9b4254
800
PASSED
#include <bits/stdc++.h> #define mod (10e9 + 7) #define ll long long int #define llc long long char using namespace std; int as(const void *a, const void *s) { return *(char *)s - *(char *)a; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); ll xx; cin >> xx; // cin.ignor...
C++
e519e4495c9acef4c4a614aef73cb322
a503dab4b97f0421056ff0c1f459b5b9
800
PASSED
#include <bits/stdc++.h> #define mod (10e9 + 7) #define ll long long int #define llc long long char using namespace std; int as(const void *a, const void *s) { return *(char *)s - *(char *)a; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); ll xx; cin >> xx; // cin.ignor...
C++
e519e4495c9acef4c4a614aef73cb322
8209ddc3c4dc8c0a5bbd6746dcd2e2f7
800
PASSED
#include<bits/stdc++.h> #define ll long long #define ull unsigned long long #define pb push_back #define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL)); using namespace std; int main() { fastread(); //freopen("input.txt","r", stdin); ll t,n,...
C++
e519e4495c9acef4c4a614aef73cb322
6bd8718641d8051867ca8c20591485a6
800
PASSED
#include<bits/stdc++.h> using namespace std; int main() { int a; cin>>a; while(a--){ long long int b,c,d; int hang=0,lie=0; cin>>b>>c>>d; hang=(d-1)%b+1-1; lie=(d-1)/b+1; cout<<hang*c+lie<<endl; } return 0; }
C++
e519e4495c9acef4c4a614aef73cb322
59e78396572df9ade311ea69e60ad9da
800
PASSED
#include<iostream> #include<algorithm> #include<cstring> #include<vector> using namespace std; int main(){ int t; cin>>t; while(t--){ long long n,m,x; cin>>n>>m>>x; long long x1=0,y1=0; if(x%n==0)y1=x/n; else y1=x/n+1; x1=x-n*(y1-1); long long res=(x1-1)*m+y1; cout<<res<<endl; } return 0; } ...
C++
e519e4495c9acef4c4a614aef73cb322
a79ba1cf48cf3b85b986f3969cb80277
800
PASSED
#include "bits/stdc++.h" using namespace std; long long int n,t, m, x; int a[110]; int main() { cin >> t; while(t--) { cin >> n >> m >> x; long long int r = x % n, c = x / n; if(r == 0) { cout << (n - 1) * m + c<< endl; } else cout << (r - 1) * m + c + 1<< endl; } }
C++
e519e4495c9acef4c4a614aef73cb322
256400ea380210a0c88d99e60593d727
800
PASSED
#include<iostream> using namespace std; int main() { long long int a,b,c,d,i,j; cin>>a; while(a--) { cin>>b>>c>>d; i=d/b+1; j=d%b; if(j==0) i--,j=b; long long num=(j-1)*c+i; cout<<num<<endl; } } ...
C++
e519e4495c9acef4c4a614aef73cb322
de1e6a918a5add7a87b882bf4c45bf1d
800
PASSED
#include <iostream> #include <string> #include <deque> using namespace std; int Substring(string s1, string s2) { if (s2.find(s1) != string::npos) return s2.find(s1); return -1; } int main() { int t, n; cin >> t; for (int k = 0; k < t; k++) { string a, b; cin >> a >> b; if (a == b) cout << 0 << end...
C++
36aec7a06c02052f562ea3d44d4a62e4
79c3de3bc004af3fad0efb4576b48ca6
1,000
PASSED
#include<bits/stdc++.h> using namespace std; string a,b; int kp(int x,int y){ int ans=0; for(int i=x,j=y;i<a.size(),j<b.size();j++,i++){ if(a[i]==b[j]){ ans++; } else{ break; } } return ans; } int main() { int t; cin>>t; while(t--){ cin>>a>>b; int ans=0; for(int i=0;i<a.size();i++){ fo...
C++
36aec7a06c02052f562ea3d44d4a62e4
d7bf2d688847ea942ad4bd401d09de19
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { string a, b; int la, lb, l = 0; cin >> a >> b; la = a.length(), lb = b.length(); for(int len = min(la, lb); len >= 1; len--) { for(int i=0; i<=la-len; i++) { ...
C++
36aec7a06c02052f562ea3d44d4a62e4
f1354a1d5190f0e48443f7959a682a66
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define int long long signed main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); #ifdef Clion freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t; cin >> t; while (t--) ...
C++
36aec7a06c02052f562ea3d44d4a62e4
dfbfee04fbc4dfec1d6a05c0e63ac624
1,000
PASSED
#include <iostream> #include<bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define sz(s) (int)s.size() // vector<vector<char>>a(n, vector<char>(n)); // freopen("in.txt", "r", stdin); void faster() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int ...
C++
36aec7a06c02052f562ea3d44d4a62e4
62e15d724a9af4b92316464aedcef923
1,000
PASSED
#include <bits/stdc++.h> using namespace std; #define dbg(x) cout << #x << " is " << x << "\n"; int LCS(string X, string Y) { int m=X.length(); int n=Y.length(); int maxlen = 0; int endingIndex = m; int lookup[m + 1][n + 1]; memset(lookup, 0, sizeof(lookup)); for (int i = 1;...
C++
36aec7a06c02052f562ea3d44d4a62e4
6163051390ade574e47848136dab526d
1,000
PASSED
#include<bits/stdc++.h> using namespace std; string a,b; int n,m,T,r; void work(){ cin>>a>>b,r=0,n=a.size(),m=b.size(); for(int len=1;len<=n;len++)for(int i=0;i+len-1<n;i++)if(b.find(a.substr(i,len))!=string::npos)r=max(len,r); cout<<n+m-r*2<<'\n'; } int main(){ for(cin>>T;T--;)work(); } ...
C++
36aec7a06c02052f562ea3d44d4a62e4
ce5c41a7cd21ab086687d423ec482871
1,000
PASSED
#include<iostream> #include<algorithm> #include<string.h> #include<string> #include<map> #include<queue> using namespace std; const int INF=0x3f3f3f3f; const int N=2e5+10; int dir[8][2]={0,1,1,1,1,0,1,-1,0,-1,-1,-1,-1,0,-1,1}; int main() { int t; cin>>t; while(t--) { string s,p; cin>>s>>...
C++
36aec7a06c02052f562ea3d44d4a62e4
ba3bd2498c21a0f7af3108b835c54675
1,000
PASSED
// Práctica 2, Reto F // Jose Antonio López // A01610805 #include <string> #include <cstring> #include <iostream> using namespace std; int max (int x, int y) { if(x > y) { return x; } else { return y; } } int simil(string s1, string s2, int i, int j){ int count = 0; int V[i+1][...
C++
36aec7a06c02052f562ea3d44d4a62e4
916bae06c25228aa75eb9c002ad48e3f
1,000
PASSED
/* Adrian Luevanos Castillo A00827701 11/09/2021 Longest Substring */ #include <iostream> #include <string> #include <vector> int longest_sub(std::string s1, std::string s2) { //O(n x m) int max = 0; std::vector<std::vector<int>> lcs; std::vector<int> check; for (int i = 0; i < s1.length(); i++) ...
C++
36aec7a06c02052f562ea3d44d4a62e4
54967fbf7393cd0336f623f320afa767
1,000
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; string s; cin >> s; int fs = -1, ls = n; for(int i = 0; i < n; i++) { if(s[i] == '*') { if(fs == -1)...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
3dcac896d4d13be7f557684dd29e072a
1,100
PASSED
#include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; int t; int main() { cin >> t; while (t--) { string s; int n, k; cin >> n >> k; cin >> s; int l = s.find('*'); int ans = 0; if(l >= 0) { s[l] =...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
379becd96f597926db4ef42d19ab9138
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define output(v) for(auto&it:v){cout<<it<<" ";}cout<<"\n" #define input(v) for(auto&it:v){cin>>it;} void FastCode() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } const int N=1e6+5; bool prime[N]; vector<int>primes; void sieve() { ...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
e96182d05f6d610b8f61d98c6e2ee226
1,100
PASSED
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { int t; cin >> t; while (t--) { int n, k; string s; cin >> n >> k; cin >> s; int b, e; int count = 0; int pos; b = s.find('*'); e = s.rfind('*'); pos = b + k; if (b == e) count = 1; else { count = 2...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
46e5ddded75b9ce70b8424ac1bc6ea16
1,100
PASSED
#include<bits/stdc++.h> using namespace std; #define ull unsigned long long #define ll long long #define db double #define fl float #define nn putchar('\n') #define for0(l) for(i=0;i<=l;++i) #define for1(l) for(i=1;i<=l;++i) #define refor0(l) for(i=l;i>=0;--i) #define refor1(l) for(i=l;i>=1;--i) int i; //-------------...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
a25108777ab44b5867617b981f2f994a
1,100
PASSED
#include <iostream> #include <stdio.h> #include <string> using namespace std; int main() { int t; cin >> t; while(t--) { int n, k; cin >> n >> k; string s; cin >> s; int count_replace = 0; int count_stars = 0; int last_star_index = 0; int pr...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
545044a873fe5a7983d28684b4f529a9
1,100
PASSED
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int t, n, k; string s; cin >> t; bool flag = false; while (t--) { if (flag)cout << " " << endl; int p = 0, a = 0; int last = -1; cin >> n >> k; cin >> s; for (int i = 0; i < n; ++i) { if (s[i] == '*') { if (last == -1...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
0fe799a6333d5a2e64c93c9a06db1fb1
1,100
PASSED
#include <bits/stdc++.h> using namespace std; int main() { int t, n, k; string s; cin >> t; while(t--){ cin >> n >> k >> s; vector <int> pos; for(int i=0; i<n; i++) if(s[i] == '*') pos.push_back(i); int idx=0, count=0; while(idx < pos.size()){ count++; if(idx == pos.size()-1) break; i...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
6ab64fd994abf27a3c28a5357d555a12
1,100
PASSED
//sudo apt install bcmwl-kernel-source //#include "bits/stdc++.h" #include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <queue> #include <deque> #include <bitset> #include <iterator> #include <stdlib.h> #include <climits> #include <list> #include <stack> #include <map>...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
1eed4425429a049f3ba9857309231577
1,100
PASSED
#include<bits/stdc++.h> typedef long long ll; using namespace std; int b = 0; int a[55]; int main() { string s; int t,cnt,ans,n,k,last; cin>>t; while(t--) { cnt=0,ans=2; cin>>n>>k; cin>>s; for(int i=0;i<s.size();++i) if(s[i]=='*') a[cnt++]=i; last=a[0]; int maxnow=a[0]; for(int i=0;i<cnt;++i...
C++
874e22d4fd8e35f7e0eade2b469ee5dc
2be3519221834fbd1176e5c9e6ca0eca
1,100
PASSED
#include <bits/stdc++.h> using namespace std; #define fer(i, a, b) for (int i = a; i <= b; ++i) #define der(i,a,b) for(int i = a ; i >= b ; -- i) #define pb push_back #define br break #define con continue #define debug(a) cout << #a << ": " << a << endl #define out(a) cout << a << endl #define yes cout << "YES...
C++
db0e6e67ca1184c5759fc488a3dff24e
e23aec5a869ff96024833783641bf623
2,000
PASSED
#include <bits/stdc++.h> ////template ////TIM DEE AB.CD.2022 XY:ZQ ////m i h a i using namespace std; #define timurr int32_t #define expert main() #define liubliu ios_base::sync_with_stdio(false); #define slavica cin.tie(NULL); #define paiu return #define scuza return #define mihai ; #define momen...
C++
db0e6e67ca1184c5759fc488a3dff24e
52c1c3bf5e640427ce0df91e7066c24c
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=1e5+5; #define P pair<int, int> #define INF 0x3f3f3f3f #define int long long /* 对于一个点(x, y) if (x+y)%2==0:那么它会先向左下走一次,然后一直往右下走 if (x+y)%2==1:那么它会一直往右下走 可以发现,对于从每一行的起点,它所在的,方向 左上->右下的那一斜列,x-y = 定值 所以可以根据这个定值来判断两点之间差几斜行(dis) 由于答案一定存在,所以一定先跑x...
C++
db0e6e67ca1184c5759fc488a3dff24e
22dcd9f73eb3faf5ff87ef908c57e7e5
2,000
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn=1e5+5; #define P pair<int, int> #define INF 0x3f3f3f3f #define int long long /* 假设我们现在找到了一段合法路线,其中A,B为目前这条合法路线的最后两点 结论: 我们只需要找出还不存在于路线中的点C,使得|BC|最大,这样点C就能成为下一个点 接下来就继续找点D满足|CD|最大即可 最后输出点序即可,所以不存在−1的情况 证明: 如果我们接下来找的点C能够满足|B...
C++
db0e6e67ca1184c5759fc488a3dff24e
44a37bbe8c653aaa82f2106f51eafcb3
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define YES cout << "YES" << endl #define NO cout << "NO" << endl #define all(_) _.begin(), _.end() #define sz(_) (int)_.size() #define fs first #define se second #define Odd(_x) ((_x) & 1) using i64 = long long; using ll = long long; const int N = 100000; con...
C++
db0e6e67ca1184c5759fc488a3dff24e
dad62a00c63911243fca75f058ce38a8
2,000
PASSED
#include <bits/stdc++.h> #define ll long long using namespace std; struct node { int x,y; }s[200005]; int n; bool cmp(node a,node b) { return a.x<b.x; } void solve() { cin>>n; for(int i=1;i<=n;i++){ cin>>s[i].x; } for(int i=1;i<=n;i++){ cin>>s[i].y; } sort(s+1,s+1+n,cmp); i...
C++
db0e6e67ca1184c5759fc488a3dff24e
3f4621ade2ac1a21fb5f2e99ca672016
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define initIO() \ ios::sync_with_stdio(false); \ cin.tie(nullptr); \ cout.tie(nullptr); ...
C++
db0e6e67ca1184c5759fc488a3dff24e
47412da07030847bf2ad53f56cb2741d
2,000
PASSED
// LUOGU_RID: 93364555 #include<bits/stdc++.h> using namespace std; #define int long long int const N=2e5+10; pair<int,int>p[N]; inline void solve(){ int n;cin>>n; for (int i=1;i<=n;++i) cin>>p[i].first; for (int i=1;i<=n;++i) cin>>p[i].second; sort(p+1,p+1+n); int x=1,y=1,ans=0; for (int i=1;i<=n;++i...
C++
db0e6e67ca1184c5759fc488a3dff24e
0075c22c2c9bdfa6b6fbba980faded33
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long int const N=2e5+10; pair<int,int>p[N]; inline void solve(){ int n;cin>>n; for (int i=1;i<=n;++i) cin>>p[i].first; for (int i=1;i<=n;++i) cin>>p[i].second; sort(p+1,p+1+n); int x=1,y=1,ans=0; for (int i=1;i<=n;++i){ int xx...
C++
db0e6e67ca1184c5759fc488a3dff24e
a866cb3d83a635d4436ab6e48e0c14e3
2,000
PASSED
#include<map> #include<set> #include<cmath> #include<stack> #include<array> #include<queue> #include<bitset> #include<vector> #include<string> #include<iomanip> #include<cstring> #include<iostream> #include<algorithm> #define rep(i,x,y) for(int i=x;i<=y;i++) #define per(i,x,y) for(int i=x;i>=y;i--) usin...
C++
db0e6e67ca1184c5759fc488a3dff24e
1ecbc4b1f072544074592abf98544db6
2,000
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> ordered_set; #define int long long int INF = 1e9; int MOD = 1e9 + 7; ...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
6e69c9c2869ae45471c6414fb8a0d420
2,000
PASSED
#include "bits/stdc++.h" using namespace std; using ll = long long; const ll inf = 1e9; const int md1 = 1e9+7; #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define sz(v) ((int)v.size()) #define forn(i,n) ...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
3e7dd00122a29579a309d17e3d4f0657
2,000
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long ll ; typedef long double ld ; #define FAST ios::sync_with_stdio(0), cin.tie(0),cout.tie(0) #define pb push_back #define pi pair<int,int> #define pll pair<ll,ll> #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define fr(i,a,b) for(ll ...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
1601479c8bb0dbf0ddf9d479304c1019
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long ll mod=1e9+7; vector<ll> dp; ll rec(ll i){ if(dp[i]!=-1)return dp[i]; if(i<10){ return dp[i]=1; } dp[i]=0; dp[i]=rec(i-10)+rec(i-9); dp[i]%=mod; return dp[i]; } int main() { ios_base::sync_with_stdio(false); cin.tie(NUL...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
955a5149596137024f874be63da866bf
2,000
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long ll mod=1e9+7; vector<ll> dp; ll rec(ll i){ if(dp[i]!=-1)return dp[i]; if(i<10){ return dp[i]=1; } dp[i]=0; dp[i]=rec(i-10)+rec(i-9); dp[i]%=mod; return dp[i]; } int main() { ios_base::sync_with_stdio(false); cin.tie(NUL...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
d279b9b28d7093f330b9d390d8b8eb36
2,000
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long #define fr(m) for(int i=0; i<m; i++) #define fro(m) for(int i=1; i<m; i++) #define frj(m) for(int j=0; j<m; j++) #define frr(n) for(int i=n; i>=0; i--) #define pb push_back #define pf push_front #define orr || #define nl '\n' #define nll c...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
f021e9fbaa33885703e4074991d05a55
2,000
PASSED
#define rep(a, s, t) for(int a = (s); a <= (t); a++) #define per(a, t, s) for(int a = (t); a >= (s); a--) #define FOR(a, s, t) for(int a = (s); a < (t); a++) #include <iostream> #include <cstdio> #include <iomanip> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #inc...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
0f8ed373f48966bda41c9bd6d67cd4a2
2,000
PASSED
#include <bits/stdc++.h> #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <vector> using namespace std; #define ll long long #define db double #define sp system("pause...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
3c556bc86b0f61aed3bdadb95b32e44b
2,000
PASSED
//============================================================================ // Name : Saif // Author : unknown_brainn // Version : 2022 // Description : MATH //============================================================================ #include<bits/stdc++.h> #define FAST ios::sync_with_stdio...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
1cf9d4c25d39cc4bef9b2138a1a23019
2,000
PASSED
#include<bits/stdc++.h> #include <string> using namespace std; #define int long long #define ld long double #define f first #define s second #define pb push_back #define pf push_front #define ub upper_bound #define lb lower_bound #define endl '\n' #define pii pair<int,int> #define rep(i,x,y) for(int i=x; i...
C++
a30f6f5273fc6c02ac1f2bc2b0ee893e
b61203d7638c91c7f442db7c1202619f
2,000
PASSED
#include<iostream> #include<algorithm> using namespace std; struct gs{ int x,y; }; bool cmp(gs a,gs b){ if(a.x!=b.x){ return a.x<b.x; } } gs p[100005]; int main() { int t; cin>>t; while(t--){ int yg,yj,n; bool flag=false; cin>>yg>>yj>>n; for(int i=0;i<n;i++){ cin>>p[i].x; } for(int i=0;i<n;i++)...
C++
b63a6369023642a8e7e8f449d7d4b73f
9d0e9907c1402124001e280b92d46a0e
900
PASSED