记录编号 575383 评测结果 AAAAA
题目名称 Cafe Stella 最终得分 100
用户昵称 Gravatar00000 是否通过 通过
代码语言 C++ 运行时间 0.000 s
提交时间 2022-09-13 11:16:22 内存使用 0.00 MiB
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. int n;
  5. string a[20][20];
  6. int mark[20][20];
  7. int ans[20],k;
  8. int flag=0;
  9. char p;
  10. int fnd(int x,int y)
  11. {
  12. p=a[x][y][0];
  13. for(int q=1;q<=n;q++)
  14. {
  15. if(a[1][q][0]==p)
  16. {
  17. return q;
  18. }
  19. }
  20. }
  21. int check(void)
  22. {
  23. for(int q=2;q<=n;q++)
  24. {
  25. for(int w=2;w<=n;w++)
  26. {
  27. int a,b,c;
  28. a=ans[q],b=ans[w],c=ans[fnd(q,w)]+(n-1)*mark[q][w];
  29. // cout<<a<<" "<<b<<" "<<c<<endl;
  30. if(a+b!=c) return 1;
  31. }
  32. }
  33. return 0;
  34. }
  35. int main(){
  36. freopen("murasame_adultxp3.in","r",stdin);
  37. freopen("murasame_adultxp3.out","w",stdout);
  38. cin>>n;//n-1进制
  39. for(int q=1;q<=n;q++)
  40. {
  41. for(int w=1;w<=n;w++)
  42. {
  43. cin>>a[q][w];
  44. if(a[q][w].length()!=1)
  45. {
  46. flag=1;
  47. p=a[q][w][0];
  48. a[q][w]=a[q][w][1];
  49. mark[q][w]=1;
  50. }
  51. }
  52. }
  53. if(flag==0)
  54. {
  55. cout<<"FccKcuf";return 0;
  56. }
  57. int one;
  58. for(int q=1;q<=n;q++)
  59. {
  60. if(a[1][q][0]==p)
  61. {
  62. ans[q]=1;one=q;//记录等于一的位置
  63. }
  64. }
  65. int z=1;
  66. int po=one;//记录此位
  67. for(int q=2;q<=n-1;q++)
  68. {
  69. po=fnd(one,po);
  70. ans[po]=q;
  71. }
  72. ans[po]=0;
  73. if(check())
  74. {
  75. cout<<"FccKcuf";return 0;
  76. }
  77. for(int q=2;q<=n;q++)
  78. {
  79. cout<<a[1][q]<<"="<<ans[q]<<" ";
  80. }
  81. cout<<endl<<n-1;
  82. return 0;
  83. }
  84.  
  85.  
  86.  
  87.  
  88.