fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <fstream>
  4. #include <string>
  5. #include <vector>
  6. #include <deque>
  7. #include <queue>
  8. #include <stack>
  9. #include <set>
  10. #include <map>
  11. #include <algorithm>
  12. #include <functional>
  13. #include <utility>
  14. #include <bitset>
  15. #include <cmath>
  16. #include <cstdlib>
  17. #include <ctime>
  18. #include <cstdio>
  19.  
  20. using namespace std;
  21.  
  22. #define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
  23. #define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
  24.  
  25. int N;
  26. int a[60];
  27. int f[60][60];
  28.  
  29. class MultiplicationTable{
  30. public:
  31.  
  32. vector <int> getMultiplicationTable(vector <int> g){
  33. int i,j,k;
  34.  
  35. N = g.size();
  36. REP(i,N) a[i] = -1;
  37.  
  38. int x = 0;
  39. for(i=1;;i++){
  40. if(a[x] != -1) break;
  41. a[x] = i;
  42. x = g[x];
  43. }
  44.  
  45. REP(i,N+10) REP(j,N) if(a[j] == -1 && a[g[j]] != -1) a[j] = a[g[j]] - 1;
  46.  
  47. REP(i,N){
  48. if(a[i] == -1){
  49. REP(j,N) f[i][j] = i;
  50. } else {
  51. REP(j,N){
  52. int tmp = j;
  53. REP(k,a[i]) tmp = g[tmp];
  54. f[i][j] = tmp;
  55. }
  56. }
  57. }
  58.  
  59. bool good = true;
  60. REP(i,N) REP(j,N) REP(k,N) if(f[f[i][j]][k] != f[i][f[j][k]]) good = false;
  61.  
  62. vector <int> ans;
  63. if(good){
  64. REP(i,N) REP(j,N) ans.push_back(f[i][j]);
  65. } else {
  66. ans.push_back(-1);
  67. }
  68.  
  69. return ans;
  70. }
  71.  
  72. };
  73.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/4.9/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty