教练(有误2)

This commit is contained in:
James 2020-03-29 12:01:29 +08:00
parent 817eaa8a0a
commit 8b02d52112
3 changed files with 47 additions and 24 deletions

View File

@ -1,19 +1,42 @@
#include<iostream> #include <iostream>
using namespace std; using namespace std;
int main(){ int main()
int k,n,a[11][21]={0}; {
cin>>k>>n; int k, n, a[11][21] = { 0 };
for(int i=1;i<=k;i++){ cin >> k >> n;
for(int j=1;j<=n;j++){ for (int i = 1; i <= k; i++) {
int u; for (int j = 1; j <= n; j++) {
cin>>u; cin >> a[i][j] ;
a[i][u]=j;
} }
} }
bool c[21][21]; int c[21][21] = { 0 };
for(int i=1;i<=k;i++){ bool ce[21][21] = { 0 };
for(int j=i+1;j<=n;j++){ for (int i = 1; i <= n; i++) {
if(a[i][j]) for (int j = i + 1;j<=n; j++) {
c[a[1][i]][0]++;
c[a[1][i]][c[i][0]] = a[1][j];
ce[a[1][i]][c[i][0]] = 1;
} }
} }
for (int i = 1; i <= k; i++) { //k
for (int e = 1; e <= n; e++) {
for (int j = 1; j <= c[a[i][e]][0]; j++) { //
if (ce[a[i][e]][j] == 1) {
c[a[i][e]][0]--;
ce[a[i][e]][j] = 0;
for (int w = e + 1; w <= n; w++) {
if (a[i][w] == c[a[i][e]][j]) {
c[a[i][e]][0]++;
ce[a[i][e]][j] = 1;
}
}
}
}
}
}
int ans=0;
for(int i=1;i<=n;i++){
ans+=c[i][0];
}
cout<<ans;
} }

Binary file not shown.

View File

@ -1,24 +1,24 @@
## z:\Chao\src\4067_coach\test\in.txt ## z:\Chao\src\4067_coach\test\in.txt
2020/03/29 周日 9:34:29.67 2020/03/29 周日 11:59:36.44
0
----------------------------------------------- -----------------------------------------------
Process exited after 190 ms with return value -1073741819 Process exited after 230 ms with return value 0
## z:\Chao\src\4067_coach\test\In0 (7).txt ## z:\Chao\src\4067_coach\test\In0 (7).txt
2020/03/29 周日 9:34:29.67 2020/03/29 周日 11:59:36.44
4 9
----------------------------------------------- -----------------------------------------------
Process exited after 90 ms with return value 0 Process exited after 100 ms with return value 0
## z:\Chao\src\4067_coach\test\In1 (12).txt ## z:\Chao\src\4067_coach\test\In1 (12).txt
2020/03/29 周日 9:34:29.67 2020/03/29 周日 11:59:36.44
190 94
----------------------------------------------- -----------------------------------------------
Process exited after 90 ms with return value 0 Process exited after 90 ms with return value 0
## z:\Chao\src\4067_coach\test\In2 (4).txt ## z:\Chao\src\4067_coach\test\In2 (4).txt
2020/03/29 周日 9:34:29.67 2020/03/29 周日 11:59:36.44
152 123
----------------------------------------------- -----------------------------------------------
Process exited after 90 ms with return value 0 Process exited after 180 ms with return value 0