比赛 |
EYOI暨SBOI暑假快乐赛2nd |
评测结果 |
WWWWWAWEE |
题目名称 |
灌水社区 |
最终得分 |
11 |
用户昵称 |
冷月星云 |
运行时间 |
0.422 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-06-26 10:42:26 |
显示代码纯文本
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;
struct mess{
string from , to;
bool wh;
};
mess message[20];
int n , m , p , all = 0 , ans[8][8][8][8][8][8][8][8] = {0} , lans = 0;
string asdas;
int main(){
freopen("ytinummoc_2202ioah.in","r",stdin);
freopen("ytinummoc_2202ioah.out","w",stdout);
cin >> n >> m >> p;
for(int i = 1;i <= p;i++){
cin >> asdas;
}
for(int i = 1;i <= m;i++){
cin >> message[i].from >> message[i].to >> message[i].wh;
}
for(int i = 1;i <= m;i++){
for(int j = 1;j <= m;j++){
if(i != j && m >= 2){
all++;
if(message[i].wh == 1 && message[i].to == message[j].from){
ans[i][j][0][0][0][0][0][0]++;
}
if(message[j].wh == 0 && message[j].to == message[i].from){
ans[i][j][0][0][0][0][0][0]++;
}
for(int k = 1;k <= m;k++){
if(i != k && j != k && m >= 3){
ans[i][j][k][0][0][0][0][0] = ans[i][j][0][0][0][0][0][0];
all++;
if(message[j].wh == 1 && message[j].to == message[k].from){
ans[i][j][k][0][0][0][0][0]++;
}
if(message[k].wh == 0 && message[k].to == message[j].from){
ans[i][j][k][0][0][0][0][0]++;
}
for(int l =1;l <= m;l++){
if(i != l && j != l && k != l && m >= 4){
ans[i][j][k][l][0][0][0][0] = ans[i][j][k][0][0][0][0][0];
all++;
if(message[k].wh == 1 && message[k].to == message[l].from){
ans[i][j][k][l][0][0][0][0]++;
}
if(message[l].wh == 0 && message[l].to == message[k].from){
ans[i][j][k][l][0][0][0][0]++;
}
for(int o =1;o <= m;o++){
if(i != o && j != o && k != o && l!= o && m >= 5){
ans[i][j][k][l][o][0][0][0] = ans[i][j][k][l][0][0][0][0];
all++;
if(message[l].wh == 1 && message[l].to == message[o].from){
ans[i][j][k][l][o][0][0][0]++;
}
if(message[o].wh == 0 && message[o].to == message[l].from){
ans[i][j][k][l][o][0][0][0]++;
}
for(int q =1;q <= m;q++){
if(i != q && j != q && k != q && l!= q && o !=q && m >= 6){
ans[i][j][k][l][o][q][0][0] = ans[i][j][k][l][o][0][0][0];
all++;
if(message[o].wh == 1 && message[o].to == message[q].from){
ans[i][j][k][l][o][q][0][0]++;
}
if(message[q].wh == 0 && message[q].to == message[o].from){
ans[i][j][k][l][o][q][0][0]++;
}
for(int r =1;r <= m;r++){
if(i != r && j != r && k != r && l!= r && o != r && q != r && m >= 7){
ans[i][j][k][l][o][q][r][0] = ans[i][j][k][l][o][q][0][0];
all++;
if(message[q].wh == 1 && message[q].to == message[r].from){
ans[i][j][k][l][o][q][r][0]++;
}
if(message[r].wh == 0 && message[r].to == message[q].from){
ans[i][j][k][l][o][q][r][0]++;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
for(int i = 1;i <= m;i++){
for(int j = 1;j <= m;j++){
if(ans[i][j][0][0][0][0][0][0] >= n && m >= 2){
lans++;
// cout << message[i].from << " " << message[i].to << " " << message[i].wh << endl;
// cout << message[j].from << " " << message[j].to << " " << message[j].wh << endl << endl;
}
for(int k = 1;k <= m;k++){
if(ans[i][j][k][0][0][0][0][0] >= n && m >= 3){
lans++;
// cout << message[i].from << " " << message[i].to << " " << message[i].wh << endl;
// cout << message[j].from << " " << message[j].to << " " << message[j].wh << endl;
// cout << message[k].from << " " << message[k].to << " " << message[k].wh << endl << endl;
}
for(int l = 1;l <= m;l++){
if(ans[i][j][k][l][0][0][0][0] >= n && m >= 4){
lans++;
// cout << message[i].from << " " << message[i].to << " " << message[i].wh << endl;
// cout << message[j].from << " " << message[j].to << " " << message[j].wh << endl;
// cout << message[k].from << " " << message[k].to << " " << message[k].wh << endl;
// cout << message[l].from << " " << message[l].to << " " << message[l].wh << endl << endl;
}
for(int o = 1;o <= m;o++){
if(ans[i][j][k][l][o][0][0][0] >= n && m >= 5){
lans++;
}
for(int q = 1;q <= m;q++){
if(ans[i][j][k][l][o][q][0][0] >= n && m >= 6){
lans++;
}
for(int r = 1;r <= m;r++){
if(ans[i][j][k][l][o][q][r][0] >= n && m >= 7){
lans++;
}
}
}
}
}
}
}
}
cout << lans << " " << all;
return 0;
}