fork download
  1. start = clock();
  2. ans = 0;
  3. for (int i = 0; i < 100 * 1000 * 1000; ++i) {
  4. for (int x = 0; x < 2; ++x) {
  5. if ((x + basex >= 0) && (x + basex < size)) {
  6. for (int y = 0; y < 2; ++y) {
  7. if ((y + basey >= 0) && (y + basey < size)) {
  8. for (int z = 0; z < 2; ++z) {
  9. if ((z + basez >= 0) && (z + basez < size)) {
  10. ans += v[x + basex][y + basey][z + basez];
  11. ans *= v[x + basex][y + basey][z + basez];
  12. ans ^= v[x + basex][y + basey][z + basez];
  13. }
  14. }
  15. }
  16. }
  17. }
  18. }
  19. }
  20. cout << (clock() - start) / CLOCKS_PER_SEC << endl;
  21. cout << ans << endl;
  22. start = clock();
  23. ans = 0;
  24. const array<array<int, 3>, 8> delta = {
  25. 0, 0, 0,
  26. 0, 0, 1,
  27. 0, 1, 0,
  28. 0, 1, 1,
  29. 1, 0, 0,
  30. 1, 0, 1,
  31. 1, 1, 0,
  32. 1, 1, 1
  33. };
  34. for (int i = 0; i < 100 * 1000 * 1000; ++i) {
  35. for (auto& t : delta) {
  36. auto& x = t[0];
  37. auto& y = t[1];
  38. auto& z = t[2];
  39. if ((x + basex < 0) || (x + basex >= size) ||
  40. (y + basey < 0) || (y + basey >= size) ||
  41. (z + basez < 0) || (z + basez >= size)) {
  42. continue;
  43. }
  44. ans += v[x + basex][y + basey][z + basez];
  45. ans *= v[x + basex][y + basey][z + basez];
  46. ans ^= v[x + basex][y + basey][z + basez];
  47. }
  48. }
  49. cout << (clock() - start) / CLOCKS_PER_SEC << endl;
  50. cout << ans << endl;
  51.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:5: error: ‘start’ does not name a type
     start = clock();
     ^~~~~
prog.cpp:2:5: error: ‘ans’ does not name a type
     ans = 0;
     ^~~
prog.cpp:3:5: error: expected unqualified-id before ‘for’
     for (int i = 0; i < 100 * 1000 * 1000; ++i) {
     ^~~
prog.cpp:3:21: error: ‘i’ does not name a type
     for (int i = 0; i < 100 * 1000 * 1000; ++i) {
                     ^
prog.cpp:3:44: error: expected unqualified-id before ‘++’ token
     for (int i = 0; i < 100 * 1000 * 1000; ++i) {
                                            ^~
stdout
Standard output is empty