Submission #600595

# Submission time Handle Problem Language Result Execution time Memory
600595 2022-07-21T06:05:14 Z MadokaMagicaFan Bit Shift Registers (IOI21_registers) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
const ll inf = 1e9;
const int md1 = 1e9+7;
const int md2 = 998244353;

#define sz(v)                       ((int)v.size())
#define pb                          push_back

#define pry                         cout << "YES\n"
#define prn                         cout << "NO\n"
#define endl                        '\n'

#define fst                         first
#define scn                         second
#define ONPC

void append_move(int t, int y);
void append_store(int t, vector<bool> v);
void append_and(int t, int x, int y);
void append_or(int t, int x, int y);
void append_xor(int t, int x, int y);
void append_not(int t, int x);
void append_left(int t, int x, int p);
void append_right(int t, int x, int p);
void append_add(int t, int x, int y);

void
construct_instructions(int s, int n, int k, int q)
{
    assert(!s);
    vector<bool> v(2000);

    append_store(0, v);
    vector<int> a(n, 0);

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < k; ++j) {
            if(v[i*k+j]) a[i] += (1<<j);
        }
    }

    int mn = 0;

    for (int i = 0; i < n; ++i)
        if (a[i] < a[mn]) mn = i;

    append_right(1,0,mn*k);
    append_right(2,1,k);
    append_left(2,2,k);
    append_xor(0,1,2);

    return;
}


#ifdef ONPC
void
solve()
{

}

int32_t
main(int argc, char **argv)
{
    if (argc >= 2) {
        freopen(argv[1], "r", stdin);
    } else
        ios_base::sync_with_stdio(0);cin.tie(0);
    int t = 1;
    /* cin >> t; */
    while(t--)
        solve();
}
#endif

Compilation message

registers.cpp: In function 'int32_t main(int, char**)':
registers.cpp:72:7: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   72 |     } else
      |       ^~~~
registers.cpp:73:38: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   73 |         ios_base::sync_with_stdio(0);cin.tie(0);
      |                                      ^~~
registers.cpp:71:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |         freopen(argv[1], "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccdbkEB5.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccdIGES1.o:registers.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status