Submission #167755

# Submission time Handle Problem Language Result Execution time Memory
167755 2019-12-10T03:54:28 Z davitmarg Vision Program (IOI19_vision) C++17
0 / 100
4 ms 932 KB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 998244353ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
using namespace std;

#ifndef death
#include "vision.h"
#endif

#ifdef death

int add_not(int x)
{
    cout << "add_not " << x << endl;
}

int add_and(vector<int> a)
{
    cout << "add_and ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_or(vector<int> a)
{
    cout << "add_or ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

int add_xor(vector<int> a)
{
    cout << "add_xor ";
    for (int i = 0; i < a.size(); i++)
        cout << a[i] << " ";
    cout << endl;
}

#endif

int n, m, k;

int ind(int y, int x)
{
    return y * m + x;
}

int id;
vector<vector<int>> p;

void construct_network(int H, int W, int K)
{
    srand(5578);
    n = H;
    m = W;
    k = K;
    id = n * m;
    vector<int> last;

    vector<pair<int, int>> pos;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            pos.PB(MP(i, j));
    random_shuffle(all(pos));
    for (int k = 0; k < pos.size() && id < 10000 - 2; k++)
    {
        int i = pos[k].first;
        int j = pos[k].second;
        vector<int> x;
        for (int I = 0; I < n; I++)
            for (int J = 0; J < m; J++)
                if (abs(i - I) + abs(j - J) == k)
                    x.PB(ind(I, J));

        if (x.empty())
            continue;

        add_xor(x);
        id++;

        x.clear();
        x.PB(id - 1);
        x.PB(ind(i, j));

        add_and(x);
        id++;
        last.PB(id - 1);
    }

    add_or(last);
}

#ifdef death

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    construct_network(N, M, K);
    return 0;
}

#endif

/*
 
 
 
*/

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:87:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int k = 0; k < pos.size() && id < 10000 - 2; k++)
                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 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 256 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 256 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 256 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 440 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 932 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -