Submission #909890

# Submission time Handle Problem Language Result Execution time Memory
909890 2024-01-17T14:48:35 Z biank Vision Program (IOI19_vision) C++14
0 / 100
20 ms 3280 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
#define SIZE(x) (int)x.size()
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define pb push_back

typedef vector<int> vi;

pair<vi,vi> process(vector<vi> diag) {
    int SZ=SIZE(diag);
    vi one(SZ), two(SZ);
    forn(i,SZ) {
        assert(!diag.empty());
        one[i] = add_or(diag[i]);
        two[i] = add_and({one[i], add_not(add_xor(diag[i]))});
    }
    return {one,two};
}

int join(vi one, vi two, int K) {
    vi instructions=two;
    int SZ=SIZE(one);
    forn(i,SZ-K) {
        vi group;
        forsn(j,i,i+K+1) group.pb(one[i]);
        instructions.pb(add_and({add_or(group), add_not(add_xor(group))}));
    }
    return add_or(instructions);
}

void construct_network(int H, int W, int K) {
    int SZ=H+W-1;
    vector<vi> diagA(SZ), diagB(SZ);
    forn(i,H) forn(j,W) {
        diagA[i+j].pb(i*W+j);
        diagB[i-j+W-1].pb(i*W+j);
    }
    auto [oneA, twoA] = process(diagA);
    auto [oneB, twoB] = process(diagB);
    int aux1 = add_and({join(oneA, twoA, K), join(oneB, twoB, K)});
    int aux2 = add_and({join(oneA, twoA, K-1), join(oneB, twoB, K-1)});
    add_and({aux1, add_not(aux2)});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   40 |     auto [oneA, twoA] = process(diagA);
      |          ^
vision.cpp:41:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   41 |     auto [oneB, twoB] = process(diagB);
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 856 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (1, 1), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 3280 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -