Submission #1366072

#TimeUsernameProblemLanguageResultExecution timeMemory
1366072haiphong5g0Message (IOI24_message)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "message.h"
#define task "TEST"
#define task2 "A"
#define pl pair<ll, ll>
#define VI vector<int>
#define VL vector<ll>
#define pf push_front
#define pb push_back
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b, c) for (int i=a; i<=b; i+=c)
#define FORE(i, a, b, c) for (int i=a; i>=b; i+=c)
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int Mod = 1e9+7;
const int maxn = 2e5;
const ll Inf = 1e16;
ll n, q, dp[maxn+1];
const int check = 25;
void send_message(vector<bool> M, vector<bool> C)
{
    vector<bool> F(31, 0), F2(31, 1);
    vector<int> V;
    int n = M.size();
    for (auto p : V) {
        if (n % 2 == 1) F2[p] = 1;
        else F2[p] = 0;
        n /= 2;
    }
    while (M.size() < 1024) M.pb(0);
    FOR(i, 1, check, 1) send_packet(F);
    send_packet(F2);
    int c = 0;
    FOR(i, 1, 64, 1) {
        vector<bool> V2(31, 0);
        if (c == M.size()) break;
        FOR(j, 0, 30, 1) {
            if (C[j]) continue;
            if (c < M.size()) V2[j] = M[c++];
        }
        send_packet(V2);
    }
}
vector<bool> receive_message(vector<vector<bool>> R) 
{
    vector<bool> res, safe(32, 1);
    int num = 1, s = 0;
    FOR(i, 0, check-1, 1) {
        FOR(j, 0, 30, 1) {
            if (R[i][j] == 0) safe[j] = 0;
        }
    }
    FOR(j, 0, 30, 1) {
        if (!safe[j]) continue;
        s += num * R[check][j]; num *= 2;
    }
    FOR(i, check+1, R.size()-1, 1) {
        if (s == 0) break;
        FOR(j, 0, 30, 1) {
            if (!safe[j]) continue;
            if (s > 0) res.pb(R[i][j]), s--;
        }
    }
    return res;
}
vector<bool>
void Read()
{
    //15 12 2 10 21
    //4 2 3 3 1
}
void Solve()
{
    for (auto p : calculate_costs({1, 100, 200, 300, 400}, {5, 4, 5, 6, 10}, {1, 2, 2, 3, 2}, {99, 100, 200})) cout << p << '\n';
}
int main()
{
    if (fopen (task".inp", "r")) {
        freopen (task".inp", "r", stdin);
        freopen (task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t;
    for (t=1; t--;)
    {
        Read(); Solve();
    }
}

Compilation message (stderr)

message.cpp:71:1: error: two or more data types in declaration of 'Read'
   71 | vector<bool>
      | ^~~~~~~~~~~~
message.cpp: In function 'void Solve()':
message.cpp:79:19: error: 'calculate_costs' was not declared in this scope
   79 |     for (auto p : calculate_costs({1, 100, 200, 300, 400}, {5, 4, 5, 6, 10}, {1, 2, 2, 3, 2}, {99, 100, 200})) cout << p << '\n';
      |                   ^~~~~~~~~~~~~~~
message.cpp: In function 'int main()':
message.cpp:92:9: error: 'Read' was not declared in this scope; did you mean 'read'?
   92 |         Read(); Solve();
      |         ^~~~
      |         read
message.cpp:84:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   84 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
message.cpp:85:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   85 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~