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,K;
  26. int ans[1000000][3];
  27.  
  28. void add(int x, int y, int z){
  29. ans[K][0] = x % N + 1;
  30. ans[K][1] = y % N + 1;
  31. ans[K][2] = z % N + 1;
  32. K++;
  33. }
  34.  
  35. int main(void){
  36. int i,j;
  37.  
  38. cin >> N;
  39.  
  40. bool even = (N % 2 == 0);
  41. if(even) N--;
  42.  
  43. for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
  44.  
  45. if(even){
  46. for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
  47. N++;
  48. REP(i,N-1) add(N-1, i, (i+1)%(N-1));
  49. REP(i,N-1) add(N-1, i, (i+1)%(N-1));
  50. REP(i,N-1) add(N-1, i, (i+2)%(N-1));
  51. }
  52.  
  53. cout << K << endl;
  54. REP(i,K) printf("%d %d %d\n", ans[i][0], ans[i][1], ans[i][2]);
  55.  
  56. return 0;
  57. }
  58.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, or enum expected
#include <iostream>
         ^
Main.java:2: error: illegal character: '#'
#include <sstream>
^
Main.java:3: error: illegal character: '#'
#include <fstream>
^
Main.java:4: error: illegal character: '#'
#include <string>
^
Main.java:5: error: illegal character: '#'
#include <vector>
^
Main.java:6: error: illegal character: '#'
#include <deque>
^
Main.java:7: error: illegal character: '#'
#include <queue>
^
Main.java:8: error: illegal character: '#'
#include <stack>
^
Main.java:9: error: illegal character: '#'
#include <set>
^
Main.java:10: error: illegal character: '#'
#include <map>
^
Main.java:11: error: illegal character: '#'
#include <algorithm>
^
Main.java:12: error: illegal character: '#'
#include <functional>
^
Main.java:13: error: illegal character: '#'
#include <utility>
^
Main.java:14: error: illegal character: '#'
#include <bitset>
^
Main.java:15: error: illegal character: '#'
#include <cmath>
^
Main.java:16: error: illegal character: '#'
#include <cstdlib>
^
Main.java:17: error: illegal character: '#'
#include <ctime>
^
Main.java:18: error: illegal character: '#'
#include <cstdio>
^
Main.java:22: error: illegal character: '#'
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
        ^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
                           ^
Main.java:22: error: class, interface, or enum expected
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
                                        ^
Main.java:23: error: illegal character: '#'
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
^
Main.java:23: error: class, interface, or enum expected
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
                                                               ^
Main.java:23: error: class, interface, or enum expected
#define snuke(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
                                                                              ^
Main.java:26: error: class, interface, or enum expected
int ans[1000000][3];
^
Main.java:28: error: class, interface, or enum expected
void add(int x, int y, int z){
^
Main.java:30: error: class, interface, or enum expected
	ans[K][1] = y % N + 1;
	^
Main.java:31: error: class, interface, or enum expected
	ans[K][2] = z % N + 1;
	^
Main.java:32: error: class, interface, or enum expected
	K++;
	^
Main.java:33: error: class, interface, or enum expected
}
^
Main.java:38: error: class, interface, or enum expected
	cin >> N;
	^
Main.java:40: error: class, interface, or enum expected
	bool even = (N % 2 == 0);
	^
Main.java:41: error: class, interface, or enum expected
	if(even) N--;
	^
Main.java:43: error: class, interface, or enum expected
	for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
	^
Main.java:43: error: class, interface, or enum expected
	for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
	        ^
Main.java:43: error: class, interface, or enum expected
	for(i=1;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
	              ^
Main.java:45: error: class, interface, or enum expected
	if(even){
	^
Main.java:46: error: class, interface, or enum expected
		for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
		        ^
Main.java:46: error: class, interface, or enum expected
		for(i=2;2*i<N;i++) REP(j,N) add(j, j+i, j+2*i);
		              ^
Main.java:47: error: class, interface, or enum expected
		N++;
		^
Main.java:48: error: class, interface, or enum expected
		REP(i,N-1) add(N-1, i, (i+1)%(N-1));
		^
Main.java:49: error: class, interface, or enum expected
		REP(i,N-1) add(N-1, i, (i+1)%(N-1));
		^
Main.java:50: error: class, interface, or enum expected
		REP(i,N-1) add(N-1, i, (i+2)%(N-1));
		^
Main.java:51: error: class, interface, or enum expected
	}
	^
Main.java:54: error: class, interface, or enum expected
	REP(i,K) printf("%d %d %d\n", ans[i][0], ans[i][1], ans[i][2]);
	^
Main.java:56: error: class, interface, or enum expected
	return 0;
	^
Main.java:57: error: class, interface, or enum expected
}
^
49 errors
stdout
Standard output is empty