Submission #21283095


Source Code Expand

Copy
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }




void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto A = new int[][](N, N);
      foreach (x; 0 .. N) foreach (y; 0 .. N) {
        A[x][y] = readInt();
      }
      
      writeln(1 << N);
      foreach (p; 0 .. 1 << N) {
        foreach (x; 0 .. N) {
          foreach (y; 0 .. N) {
            int a = A[x][y];
            if (p & 1 << x) a *= -1;
            if (p & 1 << y) a *= -1;
            if (y > 0) write(" ");
            write(a);
          }
          writeln;
        }
      }
    }
  } catch (EOFException e) {
  }
}

Submission Info

Submission Time
Task G - D. D. Construction
User hos_lyric
Language D (LDC 1.20.1)
Score 100
Code Size 1781 Byte
Status AC
Exec Time 20 ms
Memory 3400 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 1
AC × 56
Set Name Test Cases
Sample 0_0_sample_00
All 0_0_sample_00, 10_10_00, 10_10_01, 10_10_02, 10_10_03, 10_10_04, 10_10_05, 10_10_06, 10_10_07, 10_10_08, 10_10_09, all_zero_00, all_zero_01, det_zero_00, det_zero_01, det_zero_02, det_zero_03, det_zero_04, largevalhadamard_00, largevalhadamard_01, largevalhadamard_02, largevalhadamard_03, largevalhadamard_04, largevalhadamard_05, largevalhadamard_06, largevalhadamard_07, largevalhadamard_08, largevalhadamard_09, maxdet_00, maxdet_01, maxdet_02, maxdet_03, maxdet_04, maxdet_05, maxdet_06, maxdet_07, maxdet_08, maxdet_09, random_00, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, random_13, random_14, sameval_00, sameval_01, sameval_02
Case Name Status Exec Time Memory
0_0_sample_00 AC 7 ms 3188 KB
10_10_00 AC 4 ms 3372 KB
10_10_01 AC 4 ms 3296 KB
10_10_02 AC 3 ms 3340 KB
10_10_03 AC 5 ms 3228 KB
10_10_04 AC 4 ms 3192 KB
10_10_05 AC 8 ms 3116 KB
10_10_06 AC 5 ms 3344 KB
10_10_07 AC 10 ms 3292 KB
10_10_08 AC 9 ms 3104 KB
10_10_09 AC 8 ms 3296 KB
all_zero_00 AC 7 ms 3328 KB
all_zero_01 AC 4 ms 3384 KB
det_zero_00 AC 3 ms 3396 KB
det_zero_01 AC 3 ms 3328 KB
det_zero_02 AC 10 ms 3384 KB
det_zero_03 AC 4 ms 3192 KB
det_zero_04 AC 4 ms 3296 KB
largevalhadamard_00 AC 9 ms 3056 KB
largevalhadamard_01 AC 9 ms 3240 KB
largevalhadamard_02 AC 12 ms 3120 KB
largevalhadamard_03 AC 8 ms 3240 KB
largevalhadamard_04 AC 20 ms 3240 KB
largevalhadamard_05 AC 16 ms 3308 KB
largevalhadamard_06 AC 11 ms 3240 KB
largevalhadamard_07 AC 16 ms 3308 KB
largevalhadamard_08 AC 11 ms 3232 KB
largevalhadamard_09 AC 10 ms 3356 KB
maxdet_00 AC 15 ms 3300 KB
maxdet_01 AC 8 ms 3328 KB
maxdet_02 AC 9 ms 3180 KB
maxdet_03 AC 9 ms 3352 KB
maxdet_04 AC 9 ms 3392 KB
maxdet_05 AC 11 ms 3116 KB
maxdet_06 AC 14 ms 3292 KB
maxdet_07 AC 8 ms 3288 KB
maxdet_08 AC 8 ms 3120 KB
maxdet_09 AC 12 ms 3340 KB
random_00 AC 4 ms 3380 KB
random_01 AC 4 ms 3380 KB
random_02 AC 4 ms 3300 KB
random_03 AC 4 ms 3376 KB
random_04 AC 3 ms 3108 KB
random_05 AC 4 ms 3284 KB
random_06 AC 3 ms 3300 KB
random_07 AC 7 ms 3160 KB
random_08 AC 8 ms 3180 KB
random_09 AC 8 ms 3284 KB
random_10 AC 9 ms 3240 KB
random_11 AC 8 ms 3300 KB
random_12 AC 4 ms 3400 KB
random_13 AC 4 ms 3108 KB
random_14 AC 9 ms 3376 KB
sameval_00 AC 5 ms 3196 KB
sameval_01 AC 11 ms 3372 KB
sameval_02 AC 9 ms 3188 KB