Submission #1028561

# Submission time Handle Problem Language Result Execution time Memory
1028561 2024-07-20T04:47:01 Z onbert Vision Program (IOI19_vision) C++17
14 / 100
21 ms 3304 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
int n, m;
int id(int x, int y) {
    return x*m + y;
}

void construct_network(int N, int M, int k) {
    n = N, m = M;
    int nn[2] = {n, m};
    int ok[4];
    for (int I=0;I<=1;I++) {
        int sz = nn[I], kn = min(k, sz-1);
        vector<int> OR(sz), XOR(sz), NOTXOR(sz), TWO(sz), range;
        for (int i=0;i<sz;i++) {
            vector<int> cur;
            if (I==0) for (int j=0;j<m;j++) cur.push_back(id(i, j));
            else for (int j=0;j<n;j++) cur.push_back(id(j, i));
            OR[i] = add_or(cur);
            XOR[i] = add_xor(cur);
            NOTXOR[i] = add_not(XOR[i]);
            TWO[i] = add_and({NOTXOR[i], OR[i]});
        }
        for (int l=0, r=kn; r<sz; l++, r++) {
            // if (I==1) cout << l << " " << r << endl;
            vector<int> cur;
            for (int j=l;j<=r;j++) cur.push_back({OR[j]});
            int x = add_or(cur), y = add_xor(cur), z = add_not(y);
            range.push_back(add_and({x, z}));
        }
        vector<int> ck = TWO;
        for (int x:range) ck.push_back(x);
        ok[I] = add_or(ck);
    }
    for (int I=2;I<=3;I++) {
        int sz = nn[I];
        vector<int> OR;
        if (I==2) {
            for (int i=-n+1;i<m;i++) {
                vector<int> cur;
                for (int x=0, y=i; x<n; x++, y++) {
                    if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y));
                }
                if (cur.size()!=0) OR.push_back(add_or(cur));
            }
        } else if (I==3) {
            for (int i=0;i<2*m;i++) {
                vector<int> cur;
                for (int x=0, y=i; x<n; x++, y--) {
                    if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y));
                }
                if (cur.size()!=0) OR.push_back(add_or(cur));
            }
        }
        vector<int> range;
        for (int l=0, r=k; r<OR.size(); l++, r++) {
            // cout << l << " " << r << endl;
            range.push_back(add_and({OR[l], OR[r]}));
        }
        ok[I] = add_or(range);
    }
    int diag = add_or({ok[2], ok[3]});
    int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
    int ans = add_and({ok[0], ok[1], diag});
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:57:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |         for (int l=0, r=k; r<OR.size(); l++, r++) {
      |                            ~^~~~~~~~~~
vision.cpp:37:13: warning: unused variable 'sz' [-Wunused-variable]
   37 |         int sz = nn[I];
      |             ^~
vision.cpp:64:9: warning: unused variable 'a' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |         ^
vision.cpp:64:31: warning: unused variable 'b' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                               ^
vision.cpp:64:53: warning: unused variable 'c' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                                                     ^
vision.cpp:64:75: warning: unused variable 'd' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                                                                           ^
vision.cpp:65:9: warning: unused variable 'ans' [-Wunused-variable]
   65 |     int ans = add_and({ok[0], ok[1], diag});
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Incorrect 0 ms 388 KB WA in grader: Instruction with no inputs
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 2 ms 676 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 2948 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 644 KB Output is correct
4 Correct 3 ms 860 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 7 ms 1628 KB Output is correct
8 Correct 8 ms 1628 KB Output is correct
9 Correct 21 ms 3304 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 360 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
5 Halted 0 ms 0 KB -