fork download
  1. #pragma GCC optimize ("Ofast")
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. #define main dummy_main
  5. int main(){
  6. return 0;
  7. }
  8. #undef main
  9. int op[501];
  10. int cnt[501];
  11. int bef[501][501];
  12. class Solution{
  13. public:
  14. int unhappyFriends(int n, vector<vector<int>>& preferences, vector<vector<int>>& pairs){
  15. int i;
  16. for(vector<int> d : pairs){
  17. op[d[0]] = d[1];
  18. op[d[1]] = d[0];
  19. }
  20. for(i=(0);i<(n);i++){
  21. int j;
  22. for(j=(0);j<(n);j++){
  23. bef[i][j] = 0;
  24. }
  25. }
  26. for(i=(0);i<(n);i++){
  27. int j;
  28. for(j=(0);j<(n);j++){
  29. if(preferences[i][j] == op[i]){
  30. break;
  31. }
  32. bef[i][preferences[i][j]] = 1;
  33. }
  34. }
  35. for(i=(0);i<(n);i++){
  36. cnt[i] = 0;
  37. }
  38. for(i=(0);i<(n);i++){
  39. int j;
  40. for(j=(i+1);j<(n);j++){
  41. if(bef[i][j] && bef[j][i]){
  42. cnt[i] = cnt[j] = 1;
  43. }
  44. }
  45. }
  46. {
  47. int APIVbQlN;
  48. int YREPHmFM;
  49. if(n==0){
  50. YREPHmFM = 0;
  51. }
  52. else{
  53. YREPHmFM = cnt[0];
  54. for(APIVbQlN=(1);APIVbQlN<(n);APIVbQlN++){
  55. YREPHmFM += cnt[APIVbQlN];
  56. }
  57. }
  58. return YREPHmFM;
  59. }
  60. }
  61. }
  62. ;
  63. // cLay varsion 20200913-1
  64.  
  65. // --- original code ---
  66. // #define main dummy_main
  67. // {}
  68. // #undef main
  69. //
  70. // int op[501], cnt[501];
  71. // int bef[501][501];
  72. //
  73. // class Solution {
  74. // public:
  75. // int unhappyFriends(int n, vector<vector<int>>& preferences, vector<vector<int>>& pairs) {
  76. // for(vector<int> d : pairs){
  77. // op[d[0]] = d[1];
  78. // op[d[1]] = d[0];
  79. // }
  80. //
  81. // rep(i,n) rep(j,n) bef[i][j] = 0;
  82. // rep(i,n) rep(j,n){
  83. // if(preferences[i][j] == op[i]) break;
  84. // bef[i][preferences[i][j]] = 1;
  85. // }
  86. //
  87. // rep(i,n) cnt[i] = 0;
  88. // rep(i,n) rep(j,i+1,n) if(bef[i][j] && bef[j][i]) cnt[i] = cnt[j] = 1;
  89. //
  90. // return sum(cnt(n));
  91. // }
  92. // };
  93.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty