//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█
#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair< lo,lo > PII;
#define int long long
#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n*2;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 105;
const lo mod = 1000000007;
int n,m,b[li],a[li],k,flag,t,c[li],dp[li][li][li][5];
int cev;
string s;
vector<int> v;
inline int mul(int x,int y){
return (x%mod)*(y%mod)%mod;
}
inline int add(int x,int y){
if(x+y>=mod)return x+y-mod;
return x+y;
}
inline int f(int x,int y,int z,int kim){
int cevv=0;
if(x==0 && y==0 && z==0)return 1;
if(~dp[x][y][z][kim])return dp[x][y][z][kim];
//~ cout<<x<<" : : "<<y<<" : ;"<<z<<endl;
if(kim==1){
if(x)cevv=add(cevv,f(x-1,y,z,2));
if(z)cevv=add(cevv,f(x,y+1,z-1,2));
}
if(kim==2){
if(y)cevv=add(cevv,f(x,y-1,z,3));
if(x)cevv=add(cevv,f(x-1,y,z+1,3));
}
if(kim==2){
if(z)cevv=add(cevv,f(x,y,z-1,1));
if(y)cevv=add(cevv,f(x+1,y-1,z,1));
}
return dp[x][y][z][kim]=cevv;
}
main(void){
scanf("%lld %lld",&n,&t);
while(t--){
memset(dp,-1,sizeof(dp));
cev=n*3;
FOR{
scanf("%lld",&a[i]);
}
FOR{
scanf("%lld",&b[i]);
}
FOR{
scanf("%lld",&c[i]);
}
int aveb=0,avec=0,bvec=0;
FOR{
for(int j=1;j<=n;j++){
if(a[i]==b[j])aveb++;
}
}
FOR{
for(int j=1;j<=n;j++){
if(a[i]==c[j])avec++;
}
}
FOR{
for(int j=1;j<=n;j++){
if(b[i]==c[j])bvec++;
}
}
printf("%lld\n",f(aveb,bvec,avec,1));
}
return 0;
}
Compilation message
fishing.cpp:64:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
64 | main(void){
| ^
fishing.cpp: In function 'int main()':
fishing.cpp:65:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
65 | scanf("%lld %lld",&n,&t);
| ~~~~~^~~~~~~~~~~~~~~~~~~
fishing.cpp:70:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
70 | scanf("%lld",&a[i]);
| ~~~~~^~~~~~~~~~~~~~
fishing.cpp:73:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
73 | scanf("%lld",&b[i]);
| ~~~~~^~~~~~~~~~~~~~
fishing.cpp:76:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
76 | scanf("%lld",&c[i]);
| ~~~~~^~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
45568 KB |
Output isn't correct |
2 |
Incorrect |
56 ms |
45560 KB |
Output isn't correct |
3 |
Incorrect |
50 ms |
45560 KB |
Output isn't correct |
4 |
Incorrect |
52 ms |
45560 KB |
Output isn't correct |
5 |
Incorrect |
86 ms |
45568 KB |
Output isn't correct |
6 |
Runtime error |
101 ms |
92248 KB |
Execution killed with signal 11 |
7 |
Incorrect |
85 ms |
45560 KB |
Output isn't correct |
8 |
Runtime error |
88 ms |
92152 KB |
Execution killed with signal 11 |
9 |
Incorrect |
1046 ms |
45668 KB |
Output isn't correct |
10 |
Runtime error |
98 ms |
92152 KB |
Execution killed with signal 11 |