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 <stdlib.h>
int main()
{
long long int t;
scanf("%lld",&t);
while(t--){
long long int n;
scanf("%lld",&n);
if(n==1){
printf("0 1\n");
}
else{
printf("%lld %lld\n",1-n,n);
}
}
return 0;
}
... | C++ | a4628208668e9d838cd019e9dc03e470 | 17bbf8c8070933e3058c32778caf56c2 | 800 | PASSED |
#include<stdio.h>
#pragma warning(disable:4996)
int main()
{
int n;
scanf("%d", &n);
for(int w=0;w<n;w++)
{
long long x;
scanf("%lld", &x);
if (x - 1 != 0)printf("-%lld ", x - 1);
else printf("0 ");
printf("%lld\n", x);
}
}
| C++ | a4628208668e9d838cd019e9dc03e470 | 1c47147bfc402383bcd37a66306a6eda | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
struct edge
{
int from;
int to;
int cost;
};
typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
typedef map<int, vector<int>> MG;
typedef vector<vector<edge>> Graph_Cost;
#define fast_ios \
ios::sync_with_stdio... | C++ | a4628208668e9d838cd019e9dc03e470 | 92f945fa8557b3aafd2b8271273eb537 | 800 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main (){
int t;
cin>>t;
while(t--){
long long n;
cin>>n;
long long l=-(n-1),r=n;
cout<<l<<" "<<r<<"\n";
}
return 0;
}
| C++ | a4628208668e9d838cd019e9dc03e470 | a3693c1a3c39a12aad6c437ee88564e6 | 800 | PASSED |
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <stack>
#include <set>
#include <queue>
#include <math.h>
#include <cmath>
#include <map>
#include <cstdlib>
#define endl '\n'
#include <array>
#include <iterator>
#include <bits/stdc++.h>
using namespace std;
void fast()
{
ios_... | C++ | a4628208668e9d838cd019e9dc03e470 | 1ba9fbc30c4ceed2f0ab819171bcfa79 | 800 | PASSED |
#include"iostream"
using namespace std;
int main(){
long long n,x;
cin>>n;
while(n--){
cin>>x;
cout<<-x+1<<" "<<x<<endl;
}
return 0;
}
| C++ | a4628208668e9d838cd019e9dc03e470 | 9cbf9ffb9557d0afe99679dc92b9ebaa | 800 | PASSED |
#include<iostream>
using namespace std;
typedef long long ll;
int main()
{
int t;
cin>>t;
while(t--)
{
ll n,l,r;
cin>>n;
r=n-1;
l=-r;
r=n;
printf("%lld %lld\n",l,r);
}
return 0;
}
| C++ | a4628208668e9d838cd019e9dc03e470 | 42d44030a3db1da085db3be104f38f78 | 800 | PASSED |
#include<bits/stdc++.h>
#define ll long long
#define f(i, n, m) for(int i = n; i < m; i++)
using namespace std;
int main(){
int t; cin >> t;
while(t--) {
ll n;cin>>n;
cout<<-(n-1)<<" "<<n<<endl;
}
}
| C++ | a4628208668e9d838cd019e9dc03e470 | fc738f750bf4d17772583a5367d91d77 | 800 | PASSED |
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<utility>
using namespace std;
typedef long long ll;
int main() {
int t;
cin >> t;
while (t--) {
ll n;
cin >> n;
if (n & 1) {
... | C++ | a4628208668e9d838cd019e9dc03e470 | e5334879c3e516643131c8f62251b92d | 800 | PASSED |
#include<bits/stdc++.h>
typedef long long ll;
const ll mod=1e9+7;
using namespace std;
int t;
int main()
{
scanf("%d",&t);
while(t--)
{
int n,k;
ll ans=0;
ll p=1;
scanf("%d %d",&n,&k);
for(int i=0;i<31;i++)
{
if(k &(1<<i))
{
... | C++ | 2cc35227174e6a4d48e0839cba211724 | efdbc6e14f56acd16c73cbdb99a29721 | 1,100 | PASSED |
#include<iostream>
#include<bitset>
using namespace std;
const long mod=1e9 + 7;
int powmod(int a, int n)
{
int res = 1;
for (int i = 0; i < n; i++)res = (int)((long long )res * a % mod);
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int kase;
cin >> kase;
for (int i = 0; i < kase; i++)
{... | C++ | 2cc35227174e6a4d48e0839cba211724 | e15271a8bf084b27708d90dac0cce33c | 1,100 | PASSED |
#include<iostream>
using namespace std;
const long long mod = 1e9 + 7;
int t;
int main(){
cin>>t;
while(t--){
long long n,k,r=0,d=1;
cin>>n>>k;
while(k){
if (k&1)
r=(r+d)%mod;
d=d*n%mod;
k>>=1;
}
cout<<r<<endl;
}
... | C++ | 2cc35227174e6a4d48e0839cba211724 | a457d8e2c4eeae4b302ace43203079a2 | 1,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int main(){
long long int n,m,k;
long long int res;
long long int a[50];
scanf("%lld",&n);
for(int i = 0; i < n; i++){
scanf("%lld%lld",&m,&k);
a[0] = 1;
for(int j = 1; j < 50; j++){
a[j] = a... | C++ | 2cc35227174e6a4d48e0839cba211724 | 880c35de32dd038fa13a4d414394d713 | 1,100 | PASSED |
#include <iostream>
using namespace std;
int a[1005];
long long n,h,ans;
void opt(long long k){
if(k == 0) return;
opt(k/2);
ans *= n;
ans %=1000000007;
ans += k % 2;
}
int main() {
int t;
cin >> t;
while(t--) {
ans = 0;
cin >> n >> h;
opt(h);
cout << ans... | C++ | 2cc35227174e6a4d48e0839cba211724 | b214c1f5a2005030a043ac8f0b5ef6aa | 1,100 | PASSED |
#include <iostream>
using namespace std;
#define m 1000000007
int main() {
long long n, ans, k, ant;
int t;
cin >> t;
while (t--) {
ans = 0;
ant = 1;
cin >> n >> k;
while (k) {
if (k & 1)
ans = (ans + ant) % m;
ant = ant * n % m;
k /= 2;
}
cout << ans << endl;
}
return 0;
}
... | C++ | 2cc35227174e6a4d48e0839cba211724 | b27ad0f6692241bf275e4e43099608da | 1,100 | PASSED |
#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
#ifdef Kenshin
#include "/Myfunc/debug.h"
#else
#define pr(...) cerr << "Accpect" << '\n'
#endif
#define sp ' '
#define endl '\n'
#define pb push_back
#define mod(x) (x) % mod
#define all(x) (x).begin(), (x).... | C++ | 2cc35227174e6a4d48e0839cba211724 | 95068e11b4979f3c9333db75202da4ab | 1,100 | PASSED |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fast cin.tie(0); cin.sync_with_stdio(0);
#define ll long long
#define ull unsigned long long
#define ld long double
#define oo (ll)1e9
#define OO (ll)1e18
#define PI 3.14159265359
#define ordered_set tree<pair<int,int>, null_type, less<pair<int,i... | C++ | 2cc35227174e6a4d48e0839cba211724 | 4ce3a7109225c6799f2e93bc9988d084 | 1,100 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me(a) memset(a,0,sizeof(a))
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi pair<ll,ll>
using namespace std;
const int N = 1e5+10;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll... | C++ | 2cc35227174e6a4d48e0839cba211724 | 02f7f242ac63801e397f23345d0a7bef | 1,100 | PASSED |
#include<iostream>
#include<algorithm>
#include<bitset>
using namespace std;
typedef long long ll;
int a[50100];
const int p = 1e9 + 7;
ll mul(ll a, ll b, ll p){
ll ans = 1;
for(; b; b >>= 1){
if(b & 1) ans = (ans * a) % p;
a = (a * a) % p;
}
return ans;
}
void slove(){
int t; ci... | C++ | 2cc35227174e6a4d48e0839cba211724 | f555f4c54fe8114f45f4c9e15d857556 | 1,100 | PASSED |
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define PII pair<int,int>
#define debug(x) cerr<<"cerr:"<<#x<<"="<<x<<endl;
using namespace std;
typedef long long ll;
typedef long double LD;
const ll MOD = 1e9 + 7, inf = 0x3f3f3f3f;
inline ll read() { ll s = 0, w = 1; char ch = getchar();for (;... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | e7a481ceb49df7d02ef99e6507633c13 | 2,300 | PASSED |
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define PII pair<int,int>
#define debug(x) cerr<<"cerr:"<<#x<<"="<<x<<endl;
using namespace std;
typedef long long ll;
typedef long double LD;
const ll MOD = 1e9 + 7, inf = 0x3f3f3f3f;
inline ll read() { ll s = 0, w = 1; char ch = getchar();for (;... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | 69e8b57128e533e34cb0d1b5d261e07f | 2,300 | PASSED |
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define PII pair<int,int>
#define debug(x) cerr<<"cerr:"<<#x<<"="<<x<<endl;
using namespace std;
typedef long long ll;
typedef long double LD;
const ll MOD = 1e9 + 7, inf = 0x3f3f3f3f;
inline ll read() { ll s = 0, w = 1; char ch = getchar();for (;... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | 1c0deca8c64f5ba4cc341cdf5452db4d | 2,300 | PASSED |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;
ll bp(ll a, ll b, ll m = MOD)
{
if (b == 0LL)
{
return 1;
}
else if (b % 2 == 0)
{
ll t = bp(a, b / 2LL, m);
return t * t % ... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | 8eaf2c31bc43c3f27e1ddfa6c7078c5d | 2,300 | PASSED |
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;
ll bp(ll a, ll b, ll m = MOD)
{
if (b == 0LL)
{
return 1;
}
else if (b % 2 == 0)
{
ll t = bp(a, b / 2LL, m);
return t * t % ... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | 00ed2b7c3811e7a939835e8a6db351ab | 2,300 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define lli long long int
const lli MOD=1e9+7;
const lli mod=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
#define T... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | f4219a7eb6d415f67e1c270d648e8f07 | 2,300 | PASSED |
// /** これを翻訳している間、あなたはあなたの人生のいくつかの貴重な瞬間を無駄にしました **/
#include<bits/stdc++.h>
using namespace std;
#ifdef Zoro
#include "headers/debug.h"
#else
#define debug(x...)
#define deb(x...)
#endif
#define rep(i,x,y) for(int i=x;i<y;i++)
#define repr(i,x,y) for(int i=x;i>=y;i--)
#define int long long
#define... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | 260a50d6fe759a080ce38e2784f30c44 | 2,300 | PASSED |
//
// Created by ramizouari on 08/10/2021.
//
//
// Created by ramizouari on 08/10/2021.
//
#include <iostream>
#include <unordered_map>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <set>
#include <unordered_set>
#include <random>
template<typename A>
A pow(const A& ... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | c498d63990f5ea7a7518150c34f5552c | 2,300 | PASSED |
//
// Created by ramizouari on 08/10/2021.
//
//
// Created by ramizouari on 08/10/2021.
//
#include <iostream>
#include <unordered_map>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <set>
#include <unordered_set>
#include <random>
template<typename A>
A pow(const A& ... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | c69d7e832914a685763d378bd97ab6bc | 2,300 | PASSED |
//
// Created by ramizouari on 08/10/2021.
//
//
// Created by ramizouari on 08/10/2021.
//
#include <iostream>
#include <unordered_map>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <set>
#include <unordered_set>
#include <random>
template<typename A>
A pow(const A& ... | C++ | 320b52ac2bc0f646cf76aedf2bdf939e | c93b4c461970448962988804d8592bea | 2,300 | PASSED |
#include<cstdio>
const int maxn=2e5+10,mod=998244353;
int ans[maxn],fac[maxn],ifac[maxn],inv[maxn],m,n,sum;
int main(){
scanf("%d",&n);
fac[0]=fac[1]=ifac[0]=ifac[1]=inv[1]=1;
for(int i=2;i<=n;++i){
fac[i]=1ll*fac[i-1]*i%mod;
ifac[i]=1ll*ifac[i-1]*(inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod)%mod;
}
m=n+1>... | C++ | 6f58b157c875651127af682f34ca794c | f3ad6504505206baef7aaac10eaa4be5 | 3,000 | PASSED |
#include<cstdio>
const int maxn=2e5+10,mod=998244353;
int ans[maxn],fac[maxn],ifac[maxn],inv[maxn],m,n,sum;
int main(){
scanf("%d",&n);
fac[0]=fac[1]=ifac[0]=ifac[1]=inv[1]=1;
for(int i=2;i<=n;++i){
fac[i]=1ll*fac[i-1]*i%mod;
inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
}... | C++ | 6f58b157c875651127af682f34ca794c | eb4322f41eb0202073b222eaca6689b4 | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=2e5+10,mod=998244353;
static char obuf[1000000],*o=obuf;
#define putchar(x) (o-obuf<1000000)?(*o++=(x)):(fwrite(obuf,o-obuf,1,stdout),o=obuf,*o++=(x))
template<class T>
void qw(T out){
if(out>9)qw(out/10);
putch... | C++ | 6f58b157c875651127af682f34ca794c | 963c90c7d1fb9e39cfd7ffd63e53180a | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=2e5+10,mod=998244353;
int ans[maxn],fac[maxn],ifac[maxn],inv[maxn],m,n,sum;
inline void init(){
fac[0]=fac[1]=ifac[0]=ifac[1]=inv[1]=1;
for(ri i=2;i<=n;++i){
fac[i]=1ll*fac[i-1]*i%mod;
inv[i]=1ll*(mod-mod/i)... | C++ | 6f58b157c875651127af682f34ca794c | 03247c8f44344bfd909d047df7c19101 | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=2e5+10,mod=998244353;
static char obuf[1000000],*o=obuf;
#define putchar(x) (o-obuf<1000000)?(*o++=(x)):(fwrite(obuf,o-obuf,1,stdout),o=obuf,*o++=(x))
template<class T>
void qw(T out){
if(out>9)qw(out/10);
putch... | C++ | 6f58b157c875651127af682f34ca794c | 17af6df8ac962100a1a1b5572865fc17 | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=2e5+10,mod=998244353;
int ans[maxn],fac[maxn],ifac[maxn],inv[maxn],m,n,sum;
inline void init(){
fac[0]=fac[1]=ifac[0]=ifac[1]=inv[1]=1;
for(ri i=2;i<=n;++i){
fac[i]=1ll*fac[i-1]*i%mod;
inv[i]=1ll*(mod-mod/i)... | C++ | 6f58b157c875651127af682f34ca794c | f9ea3cdd8f8fe0af4da48098c008a778 | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ri int
typedef long long ll;
const int maxn=2e5+10,mod=998244353;
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,1:0;}
template<class T>inline void clear(T *arr,int si... | C++ | 6f58b157c875651127af682f34ca794c | 0e1a5dfbb123618b20af09dc6c9e32f7 | 3,000 | PASSED |
#include <bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;
const int Maxn=2e5;
const int Maxntt=1e6;
const int Mod=998244353;
const int G=3;
int fac[Maxn+5],inv[Maxn+5];
int f[Maxn+5],g[Maxn+5];
int a[Maxntt],b[Maxntt],c[Maxntt],d[Maxntt];
int n;
inline int ksm(int a,int b) {
int ans=1;... | C++ | 6f58b157c875651127af682f34ca794c | 64d9217e896e058505ba11afcb0dee4d | 3,000 | PASSED |
//wmh taixunle
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
int powdv(int x,int y=mod-2){
int ans=1;
while(y){
if(y&1)ans=1ll*ans*x%mod;
y>>=1,x=1ll*x*x%mod;
}
return ans;
}
int di[200005],id[200005];
int ans[200005];
int main(){
int n;
cin>>n;
di[0]=1;
for(int i=1;i<=n;++i)di[i]=1ll*i... | C++ | 6f58b157c875651127af682f34ca794c | 0ce9a7de11aa9e00a54e3110a0cdf7ee | 3,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(i,x,y) for(int i=(x);i<=(y);i++)
#define fu(i,x,y) for(int i=(x);i>=(y);i--)
int read(){
int s=0,t=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')t=-1;ch=getchar();}
while(isdigit(ch)){s=(s<<1)+(s<<3)+(ch^48);ch=getchar();}
... | C++ | 6f58b157c875651127af682f34ca794c | d19df5b1de7f076dd40b3c01b6ec60d3 | 3,000 | PASSED |
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;re... | C++ | 0068b93963c778bbb2068eac3d65223b | 25e43590cb22fed2cdeac0464aa7021f | 3,500 | PASSED |
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;re... | C++ | 0068b93963c778bbb2068eac3d65223b | e81015b0c2a767db5c67601c16ae91d9 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool Begin;
const int max_n=502;
inline int read(){
int x=0;bool w=0;char c=getchar();
while(c<'0' || c>'9') w|=c=='-',c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w?-x:x;
}
inline void write(int x){
... | C++ | 0068b93963c778bbb2068eac3d65223b | cd5415a0a7a87de543ef59137a97fe30 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
bool Begin;
const int max_n=502;
inline int read(){
int x=0;bool w=0;char c=getchar();
while(c<'0' || c>'9') w|=c=='-',c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w?-x:x;
}
inline void write(int x){
putchar(x==2?'B':'W'... | C++ | 0068b93963c778bbb2068eac3d65223b | 77aa6172c1a4579d3102d1739e9f00d8 | 3,500 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N=510;
char s[N][N],sta[4*N];int n,m,tot,X[N*4],Y[N*4];
bool check(){
for(int i=1;i<=n;i++){
if(s[i][1]=='B') return false;
}
int tot2=0;
for(int i=2;i<=m;i++) X[++tot2]=1,Y[tot2]=i;
for(int i=2;i<=n;i++) X[++tot2]=i,Y[tot2]=m;
for(int i=m-1;... | C++ | 0068b93963c778bbb2068eac3d65223b | b2881ca4db54c9d14b5aa2ffcc4caac5 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool Begin;
const int max_n=502;
inline int read(){
int x=0;bool w=0;char c=getchar();
while(c<'0' || c>'9') w|=c=='-',c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w?-x:x;
}
inline void write... | C++ | 0068b93963c778bbb2068eac3d65223b | cd3b3967f5678c79661537f45f793351 | 3,500 | PASSED |
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool Begin;
const int max_n=502;
inline int read(){
int x=0;bool w=0;char c=getchar();
while(c<'0' || c>'9') w|=c=='-',c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return w?-x:x;
}
inline void write... | C++ | 0068b93963c778bbb2068eac3d65223b | f82cfd34dd4bf6544fcf2143a9109ecb | 3,500 | PASSED |
#include<stdio.h>
int T;
int n,m;
char s[505];
int a[505][505];
int b[505][505];
int c[505][505];
int d[505][505];
int rotcnt;
int cl1,cl2;
inline void swap(int &x,int &y)
{
int tp=x;
x=y;
y=tp;
}
inline bool colorBoundary()
{
for(int i=2;i<=m;i++)
{
if(!b[1][i])
{
b[1][i]=b[1][i-1];
... | C++ | 0068b93963c778bbb2068eac3d65223b | fa22e2b6b78343fa5eec4d7d91d80bd8 | 3,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int c=505;
int t, n, m, fix[c][c], ans[c][c], rotcnt, change, old_cl, new_cl;
int fix2[c][c], ans2[c][c];
void color_boundary() {
for (int cnt=1; cnt<=2; cnt++) {
for (int j=2; j<=m; j++) {
if (!ans[1][j]) ans[1][j]=ans[1][j-1];
... | C++ | 0068b93963c778bbb2068eac3d65223b | e008974f51cead4e2a9df05fd0d88393 | 3,500 | PASSED |
// Hydro submission #62b6c85fa5aaa85be1dff062@1656146015815
#include<bits/stdc++.h>
#define int long long
using namespace std;
bool Begin;
const int max_n=502;
inline int read(){
int x=0;bool w=0;char c=getchar();
while(c<'0' || c>'9') w|=c=='-',c=getchar();
while(c>='0' && c<='9') x=(x<<1)+(x<<3)+(... | C++ | 0068b93963c778bbb2068eac3d65223b | 37dff58924c5b6e2b3d0809844f4e83c | 3,500 | PASSED |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while (t--)
{
int x,y,z;
cin>>x>>y>>z;
cout<<((x+y+z)%3==0?"0":"1")<<endl;
}
return 0;
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 3c029cb4741fd7138dc9cdab9ca4feaa | 800 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main ()
{
ll t;
cin>>t;
while(t--){
ll a,b,c;
cin>>a>>b>>c;
if((a+b+c)%3==0){
cout<< 0 << endl;
}
else {
cout<< 1 << endl;
}
}
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 048385a479c3ac3114b2b0bc8b3e3b5a | 800 | PASSED |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main ()
{
int n,a,b,c,sum=0;
cin>>n;
for (int i = 0; i < n; i++)
{
cin>>a>>b>>c;
sum = a + b + c;
if (sum % 3 == 0)
{
cout << "0" << endl;
}
else if (sum % 3 != 0)
{... | C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 9bd8e6d03a5fd180a8ada8df6f7d0756 | 800 | PASSED |
#include <bits/stdc++.h>
#define ll long long
#define sakura ios_base::sync_with_stdio;cin.tie(0);cout.tie(0);
#define all(v) ((v).begin(),(v).end())
#define sz(v) ((int)( (v).size()))
using namespace std;
ll GCD(ll a, ll b){ if (b==0)return a;GCD(b,a%b);}
ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
#define mod(a... | C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 09fa67a46e2ee039e46317a81f4ad790 | 800 | PASSED |
#include <iostream>
#include <algorithm>
#include <deque>
#define HUNTER cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0);
#define ll long long
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
using namespace std;
int main() {
int t ;
cin>>t;
while (t--) {
int a,... | C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 5b21bcd9e425ddf9f348ce457d7f61f8 | 800 | PASSED |
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
int t,d[3];
cin>>t;
while(t--){
cin>>d[0]>>d[1]>>d[2];
cout<<(bool)(abs(d[0]+d[2]-d[1]*2)%3)<<endl;
}
return 0;
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 24a2de161673820d260e27558b8fde71 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a1,a2,a3;
cin>>a1>>a2>>a3;
int d = abs((a1 + a3) - a2 * 2);
if(d % 3 == 0){
cout<<0<<'\n';
}else{
cout<<1<<'\n';
}
}
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 29db8a41e3e1c654636492aea5adaef4 | 800 | PASSED |
#include<stdio.h>
#include<math.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
if((x+y+z)%3) printf("1\n");
else printf("0\n");
}
return 0;
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | db2f1c83c7dcddd054777c4cbd67b230 | 800 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
scanf("%d",&t);
while(t--){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
long long sum=a+b+c;
if(sum%3==0)printf("0\n");
else printf("1\n");
}
return 0;
}
| C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 6c8fc0d537807a56b0b6bc944e55b9fa | 800 | PASSED |
#include<cstdio>
#include<string>
#include<iostream>
#include<list>
using namespace std;
typedef long long ll;
ll aaabs(ll temp)
{
if(temp<0)
return -temp;
return temp;
}
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
ll a,b,c;
scanf("%lld%lld%lld",&a,&b,&c);
ll temp = aaabs(2*b-a-c);
ll count = temp%3... | C++ | 5bffe38e3ac9511a30ee02b4ec5cb1d5 | 3b3b0d85014d5511b86ed9c34090591d | 800 | PASSED |
#include <iostream>
#include <cstring>
#include <bits/stdc++.h>
using namespace std;
string a;
int n;
string str[7] = {"aa", "aba", "aca", "abca", "acba", "abbacca", "accabba"};
void solve()
{
cin >> n;
cin >> a;
int mind = 1e9;
for (int i = 0; i < a.size(); i++)
for (int j = 0; j < 7; ... | C++ | c2f3d09674190f90c940f134c3e22afe | 8044414a202e7a41bfe65592a28dd94b | 1,400 | PASSED |
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
string s[7]={"aa","aba","aca","abca","acba","abbacca","accabba"};
int main()
{
int t,i,j,k,n,m,l=0;
string s1;
int mind=1e6;
scanf("%d",&t);
while(t--)
{
l=0;
cin>>n>>s1;
mind=1e6;
for(i=... | C++ | c2f3d09674190f90c940f134c3e22afe | c2b1080ac3f13ee253e6db317fd01915 | 1,400 | PASSED |
#include<stdio.h>
#include<string.h>
#include<iostream>
using namespace std;
string s[7]={"aa","aba","aca","abca","acba","abbacca","accabba"};
int main()
{
int t,i,n,m;
string s1;
scanf("%d",&t);
while(t--)
{
m=0;
cin>>n>>s1;
for(i=0;i<7;i++)
{
if(s1.find(... | C++ | c2f3d09674190f90c940f134c3e22afe | 3009ffe93998cb593e8cf695557c9777 | 1,400 | PASSED |
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
char res[7][9] = {"aa", "aca", "aba", "acba", "abca", "abbacca", "accabba"};
char pl[10];
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
int re = 100;
string lk;
cin >> n >> lk;
int ... | C++ | c2f3d09674190f90c940f134c3e22afe | 0f37bfa27eaf370cac9e7ae13ead98c0 | 1,400 | PASSED |
#include<iostream>
#include<cstring>
using namespace std;
int main(){
long long t;
cin>>t;
while(t--){
long long min=9,l,p=0;
string a;
cin>>l;
cin>>a;
for(int i=0;i<l;i++){
if(a[i]==a[i+1]&&a[i]=='a') {p=1;
min=2;
break;
}
else if(a[i]=='a'&&a[i+2]=='a'&&i<l-2){p=3;
min=3;
}
els... | C++ | c2f3d09674190f90c940f134c3e22afe | 2fa87a27d86c2e3000471eee6f3bd17f | 1,400 | PASSED |
#include<iostream>
using namespace std;
string str[7] = {"aa","aba","aca","abca","acba","abbacca","accabba"};
void solve()
{
string a;
int n ;
cin >> n >> a;
int mind = 1e9;
for(int i = 0 ; i < a.size() ; i ++)
for(int j = 0 ; j < 7 ; j ++)
if(i + str[j].size() - 1 < n && a.substr(i,... | C++ | c2f3d09674190f90c940f134c3e22afe | 8f359c67ad63bce7e5932cd4883247c0 | 1,400 | PASSED |
#include<iostream>
using namespace std;
string str[7] = {"aa","aba","aca","abca","acba","abbacca","accabba"};
void solve()
{
string a;
int n ;
cin >> n >> a;
int mind = 1e9;
for(int i = 0 ; i < a.size() ; i ++)
{
for(int j = 0 ; j < 7 ; j ++)
{
if(i + str[j].size() - 1 ... | C++ | c2f3d09674190f90c940f134c3e22afe | 52badc0ab50988165ec38c53a9dedad1 | 1,400 | PASSED |
#include<iostream>
using namespace std;
string str[7] = {"aa","aba","aca","abca","acba","abbacca","accabba"};
void solve()
{
string a;
int n ;
cin >> n >> a;
for(int j = 0 ; j < 7; j ++)
{
if(a.find(str[j]) != -1)
{
cout << str[j].size() <<endl;
return ;
... | C++ | c2f3d09674190f90c940f134c3e22afe | 60d78ca8d8507b0bf8de294528147771 | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int INF = 0x3f3f3f3f;
char a[N];
int mp[5];
void solve() {
int n;
scanf("%d", &n);
// cin >> n;
scanf("%s", a);
// string a;
// cin >> a;
vector<int> vec;
vec.emplace_back(2);
vec.emplace_back(3);
vec.em... | C++ | c2f3d09674190f90c940f134c3e22afe | 2b8fe379d2bdcaf8a11d4d3640b2b04f | 1,400 | PASSED |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int INF = 0x3f3f3f3f;
char a[N];
int mp[5];
void solve() {
int n;
scanf("%d", &n);
// cin >> n;
scanf("%s", a);
// string a;
// cin >> a;
for (int len = 2; len <= 7; len++) {
for (int i = 0; i + len - 1 < n;... | C++ | c2f3d09674190f90c940f134c3e22afe | 98bd34cea32cf241799a5cbaab0180c6 | 1,400 | PASSED |
//#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <array>
#include <list>
#include <limits>
#include <numeric>
#include <climits>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_set>
#include <bitset>
#inclu... | C++ | f472f9df8b4d588c67b39df6865507ca | 25fd0a066ac31b3254248e61643c7ed8 | 1,000 | PASSED |
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ff first
#define ss second
#define pi acos(-1.0)
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define SORT_UNIQUE(c) (s... | C++ | f472f9df8b4d588c67b39df6865507ca | fdaceb31285a488df428c26ffe756d3d | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s,k;
cin>>s;
k=s;
sort(s.begin(),s.end());
int ar[n];
int p = 0;... | C++ | f472f9df8b4d588c67b39df6865507ca | cf9a7b35ff3d5f7387d20d964cb4301e | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
char a[N];
char b[N];
for (int i = 0; i < n; i++) {
cin >> a[i];
b[i] = a[i];
}
sort(b, b + n);
... | C++ | f472f9df8b4d588c67b39df6865507ca | 246b6e389a3fcd3b5a559ca55a220729 | 1,000 | PASSED |
#include <iostream>
#include <math.h>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <iterator>
#include <utility>
using namespace std;
string s,p;
long long int t, i, n, l, j, a[1000000], b[1000000], c, d;
int main()
{
cin >> n;
while (n--)
{
cin >> l;
cin >> s;
p=s;
so... | C++ | f472f9df8b4d588c67b39df6865507ca | 278380ea5b23908b944bb87b5d279e0d | 1,000 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define fun ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
#define ll long long
#define mp make_pair
const int N = 2e5+10, M = 1e6+10;
int arr[N];
int main()
{
fun;
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
string s;
... | C++ | f472f9df8b4d588c67b39df6865507ca | f08537af42d20064faad580bdef55dc1 | 1,000 | PASSED |
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int maxn = 2e3;
typedef long long ll;
ll R()
{
ll x = 0,f = 1;
char c = getchar();
while(c>'9' || c<'0')
{
if(c=='-')f=-1;
c = getchar();
}
while(c>='0' &... | C++ | f472f9df8b4d588c67b39df6865507ca | 714bb85d1780f93c1dba4119f0aaf1b5 | 1,000 | PASSED |
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
char a[1003], b[1003];
int d[1003];
int main()
{
int t = 0;
scanf("%d", &t);
while (t--)
{
int len = 0, n = 0;
scanf("%d", &len);
scanf("%s", a);
strcpy(b, a);
sort(a, a + len);
for (int i = 0; i < len; i++)
... | C++ | f472f9df8b4d588c67b39df6865507ca | 588f676d6df29c4c7c6b686b2751a0e7 | 1,000 | PASSED |
# include<bits/stdc++.h>
#define in freopen ("herding.in", "r", stdin);
#define out freopen("herding.out", "w", stdout);
#define ll long long
#define pb push_back
#define pf push_front
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std ;
long long const N = 1e6 + 7 ;
long long N1 ... | C++ | f472f9df8b4d588c67b39df6865507ca | 684016b9294df67e66a79d7db6931795 | 1,000 | PASSED |
// ============================================================================ //
// || || //
// || International University of Business Agriculture || //
// || and Technology, DHaka, Bangladesh ... | C++ | f472f9df8b4d588c67b39df6865507ca | 8eb8135ab9828bfdad1e66e349122003 | 1,000 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define F first
#define S second
#define watch(x) cerr << (#x) << " = " << x << '\n';
#define watch2(x, y) cerr << (#x) << ... | C++ | d253d8efc344b0848a19876ff52c09a8 | f4165b7d528d53ffcd6773178ba2ffdd | 2,100 | PASSED |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define F first
#define S second
#define watch(x) cerr << (#x) << " = " << x << '\n';
#define watch2(x, y) cerr << (#x) << ... | C++ | d253d8efc344b0848a19876ff52c09a8 | 4a7755988089d92cab945c3ac1c953b7 | 2,100 | PASSED |
#include<iostream>
#include<cstdio>
#include<map>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<cstring>
#include<vector>
#include<set>
#include<cmath>
#include<cstring>
#include<cstdlib>
#define fi first
#define se second
#define ll lo... | C++ | d253d8efc344b0848a19876ff52c09a8 | 216623879af84643b8cde6603d60847d | 2,100 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <assert.h>
#include <algorithm>
#include <limits.h>
using namespace std;
vector<int> v[200005];
int isWhite[200005];
bool vis[200005];
int smallestUnused[200005];
int pow2s[60];
int msb[200005];
int rez[... | C++ | d253d8efc344b0848a19876ff52c09a8 | 5009f1d003c72f86e5f85a5e5f9abe39 | 2,100 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <assert.h>
#include <algorithm>
#include <limits.h>
using namespace std;
vector<int> v[200005];
int exxt[200005];
int t[200005];
bool vis[200005];
int level[200005];
int pow2s[60];
int msb[200005];
int ... | C++ | d253d8efc344b0848a19876ff52c09a8 | 6f6aad0f6925363b1e3ccd610fb2b663 | 2,100 | PASSED |
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <assert.h>
#include <algorithm>
#include <limits.h>
using namespace std;
vector<int> v[200005];
int exxt[200005];
int t[200005];
int stepFrom[200005];
int prevv[200005];
int maxxToEnd[200005];
bool vis[200... | C++ | d253d8efc344b0848a19876ff52c09a8 | b21f0110ddf6cf62ddc907ee4023a9ec | 2,100 | PASSED |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<ctime>
#define ll long long
using namespace std;
const int maxx=200010;
const double pi=acos(... | C++ | d253d8efc344b0848a19876ff52c09a8 | 3ce52d92a63a6055b2867f56f4ff5bdd | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI pair<int,int>
const int N = 4e5 + 10;
const int M = 1e6 + 10;
const ll Inf = 1e9 + 7;
const ll mod = 1e9 + 7;
int n;
int e[M], ne[M], h[N], idx;
int id[N], sz[N], col[N];
int len, cnt[20], p[20];
bitset<N>vis;
vector<int>A[2], B... | C++ | d253d8efc344b0848a19876ff52c09a8 | ce2ab4146981c4935a14f8ae791e334f | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI pair<int,int>
const int N = 4e5 + 10;
const int M = 1e6 + 10;
const ll Inf = 1e9 + 7;
const ll mod = 1e9 + 7;
int n;
int e[M], ne[M], h[N], idx;
int id[N], d[N], col[N];
bitset<N>vis;
void add(int a, int b){
e[idx] = b, ne[id... | C++ | d253d8efc344b0848a19876ff52c09a8 | b574e5f8367f0d977c8e892704dbad61 | 2,100 | PASSED |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI pair<int,int>
const int N = 2e5 + 10;
const int M = 1e6 + 10;
const ll Inf = 1e9 + 7;
const ll mod = 1e9 + 7;
int n;
int e[M], ne[M], h[N], idx;
vector<int>G[N];
int id[N], d[N], col[N];
bitset<N>vis;
void add(int a, int b){
... | C++ | d253d8efc344b0848a19876ff52c09a8 | 25462c3bd407f99b265bdb45bfebe2d2 | 2,100 | PASSED |
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
int n,mod,k,Com[110][110];
int dp[100][100],f[100][100],g[100][100];
int qpow(int a,int b){
int ans=1;
while(b){
if(b&1)ans=1ll*a*ans%mod;
a=1ll*a*a%mod;
b>>=1;
}
retu... | C++ | 1850d71694b25c612740bb584eb8a4c0 | 101ca7bcc695b0ec5c40c87d939016f6 | 2,900 | PASSED |
/**
* Markdown,放在编辑器里看
* $f_{i,j}=\sum\limits_{l=0}^j (-1)^{j-l}{C^j_ l}(2^l)^i$
* $g_{i,j}=\sum\limits_{i'=0}^{i-1}\sum\limits_{j'=0}^{j-1}{C^i_ {i'}}{C^j_ {j'}}(2^{j'})^{i-i'}h_{i-i',j-j'}(f_{i',j'}-g_{i',j'})$
* $h_{i,j}=\sum\limits_{l=0}^j (-1)^{j-l}{C^j_ l}(2^l-1)^i$
* 最后$ans=\sum\limits_{i=0}^k C_k^i × ... | C++ | 1850d71694b25c612740bb584eb8a4c0 | 2acbee0a24e21b3929ce4d67238069c5 | 2,900 | PASSED |
// LUOGU_RID: 91541409
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std;
int n,mod,k,Com[110][110];
int dp[100][100],f[100][100],g[100][100];
int qpow(int a,int b){
int ans=1;
while(b){
if(b&1)ans=1ll*a*ans%mod;
a=1ll*a*a%mod;
... | C++ | 1850d71694b25c612740bb584eb8a4c0 | 036d4af5ed641d1378340d18e5149c32 | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (register int (i) = (a); (i) <= (b); ++(i))
#define pre(i,a,b) for (register int (i) = (a); (i) >= (b); --(i))
const int N = 500 + 10;
int n, k, mod, fac[N * N], ifac[N * N], f[N][N], g[N][N], h[N][N], ans;
struct Light {
int bse, q, sq, dn[N], u... | C++ | 1850d71694b25c612740bb584eb8a4c0 | 5193126cfca24e76d43e1e11aeb4ae52 | 2,900 | PASSED |
#include <bits/stdc++.h>
#define F(i, l, r) for(int i = l; i <= r; i++)
using namespace std;
const int N = 83;
int n, k, P, pw[N * N], s[N][N], g[N][N], f[N][N], C[N][N];
signed main() {
scanf("%d%d%d", &n, &k, &P);
pw[0] = C[0][0] = 1;
F(i, 1, n * k) pw[i] = 2ll * pw[i - 1] % P;
F(i, 1, max(n, k)) {
... | C++ | 1850d71694b25c612740bb584eb8a4c0 | b760020d1ec80ebe103358fdb0b413d4 | 2,900 | PASSED |
/*
* @Date: 2021-11-14 11:56:32
* @LastEditors: ButterCake
* @LastEditTime: 2021-11-14 12:50:20
*/
#include <bits/stdc++.h>
#define F(i, l, r) for(int i = l; i <= r; i++)
#define R(i, r, l) for(int i = r; i >= l; i--)
using namespace std;
const int N = 83;
int n, k, P, pw[N * N], s[N][N], g[N][N], f[N][... | C++ | 1850d71694b25c612740bb584eb8a4c0 | e83b7638ef147b8c3b990720f1f16689 | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (register int (i) = (a); (i) <= (b); ++(i))
#define pre(i,a,b) for (register int (i) = (a); (i) >= (b); --(i))
const int N = 500 + 10;
int n, k, mod, fac[N * N], ifac[N * N], f[N][N], g[N][N], h[N][N], ans;
struct Light {
int bse, q, sq, dn[N], u... | C++ | 1850d71694b25c612740bb584eb8a4c0 | df15e8e4128b3e5ddcff73dfc5ccccba | 2,900 | PASSED |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 100+10;
ll f[N][N], g[N][N], h[N][N], c[N][N];
ll pow_2[N*N], mul_1[N];
ll MOD;
int n,m;
ll dcp(int x, int y){
ll res = 1;
for(int i = x; i >= x-y+1; --i) res = res * i % MOD;
return res;
}
int main(){
cin >> n >> m >> MOD;
for(int i ... | C++ | 1850d71694b25c612740bb584eb8a4c0 | b79ce31610231711dd5f099c516841c3 | 2,900 | PASSED |
/*
要求长度为i1的不good序列,或起来为2^{j1}-1
其肯定存在最优子序列
长度为i1的序列,最优子序列长度为i2
整个序列或起来为2^{j1}-1,最优子序列或起来popcount为2^{j2}-1
C[i1][i2]选出子序列
C[j1][j2]选出子序列或起来的popcount是哪几位
i1-i2:留下的
肯定互不相同,去掉j2为1的二进制位后不为0(有0就把这个0放到最优子序列里)
留下的数在j2有的部分里01皆可,即2^{j2}^{i1-i2}
留下的数不在j2有的部分里的数:设h[i][j]表示[1,2^j)组成的,或起来全是1的序列个数,则为h[i1-i2][j1-j2]
... | C++ | 1850d71694b25c612740bb584eb8a4c0 | d8ce7e6ea0d2f58482adc7a5ecdcf287 | 2,900 | PASSED |
/*
要求长度为i1的不good序列,或起来为2^{j1}-1
其肯定存在最优子序列
长度为i1的序列,最优子序列长度为i2
整个序列或起来为2^{j1}-1,最优子序列或起来popcount为2^{j2}-1
C[i1][i2]选出子序列
C[j1][j2]选出子序列或起来的popcount是哪几位
i1-i2:留下的
肯定互不相同,去掉j2为1的二进制位后不为0(有0就把这个0放到最优子序列里)
留下的数在j2有的部分里01皆可,即2^{j2}^{i1-i2}
留下的数不在j2有的部分里的数:设h[i][j]表示[1,2^j)组成的,或起来全是1的序列个数,则为h[i1-i2][j1-j2]
... | C++ | 1850d71694b25c612740bb584eb8a4c0 | 9185a2ee977332b3dae94e7e95a80eee | 2,900 | PASSED |
#include <bits/stdc++.h>
using namespace std;
/*<DEBUG>*/
#define tem template <typename
#define can_shift(_X_, ...) enable_if_t<sizeof test<_X_>(0) __VA_ARGS__ 8, debug&> operator<<(T i)
#define _op debug& operator<<
tem C > auto test(C *x) -> decltype(cerr << *x, 0LL);
tem C > char test(...);
tem C > struct itr{C b... | C++ | 6f6bb98cee5c9e646c72f3be8969c6df | 7bcce4325638b282959bfc89fd387ca6 | 2,400 | PASSED |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.