Submission #1201210

#TimeUsernameProblemLanguageResultExecution timeMemory
1201210ziad3ssam10A + B (IOI24_aplusb)C++17
Compilation error
0 ms0 KiB
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define endl '\n'
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define wady ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

void files() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
}


const int N = 1e6 + 10;
const int mod = 1e9 + 7;
pair<int, int> hsh[N], hsh_rev[N];
const int bn = 2;
int b[bn] = {37, 41};
int p[bn][N], invi[bn][N];

int add(int a, int b) { return (a + b) % mod; }

int sub(int a, int b) { return (a - b + mod) % mod; }

int mult(int a, int b) { return (1LL * a * b) % mod; }

int fp(int base, int power) {
    if (power == 0) return 1;
    int ret = fp(base, power / 2);
    ret = mult(ret, ret);
    if (power & 1) ret = mult(ret, base);
    return ret;
}

void precompute() {
    p[0][0] = p[1][0] = invi[0][0] = invi[1][0] = 1;
    int bInv[bn] = {fp(b[0], mod - 2), fp(b[1], mod - 2)};
    for (int i = 1; i < N; i++) {
        for (int j = 0; j < bn; j++) {
            p[j][i] = mult(p[j][i - 1], b[j]);
            invi[j][i] = mult(invi[j][i - 1], bInv[j]);
        }
    }
}

pair<int, int> get_hash(char c, int idx) {
    return {mult(c - 'a' + 1, p[0][idx]), mult(c - 'a' + 1, p[1][idx])};
}

pair<int, int> query(int l, int r) {
    int hash1 = hsh[r].first, hash2 = hsh[r].second;
    if (l) {
        hash1 = mult(sub(hash1, hsh[l - 1].first), invi[0][l]);
        hash2 = mult(sub(hash2, hsh[l - 1].second), invi[1][l]);
    }
    return {hash1, hash2};
}

void build(string &s) {
    int n = s.size();
    for (int i = 1; i <= n; i++) {
        hsh[i] = get_hash(s[i - 1], i);
        if (i) {
            hsh[i].first = add(hsh[i].first, hsh[i - 1].first);
            hsh[i].second = add(hsh[i].second, hsh[i - 1].second);
        }
    }
}

void solve(int tc) {
    int a,b;cin >> a >> b;
    cout << a + b << endl;

}

signed main() {
    wady
    files();
    int tt = 1;
    //cin >> tt;
    while (tt--) solve(tt);
}

Compilation message (stderr)

aplusb.cpp: In function 'void files()':
aplusb.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen("in.txt", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
aplusb.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     freopen("out.txt", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cc1UmwMt.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc52XkGY.o:aplusb.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc1UmwMt.o: in function `main':
grader.cpp:(.text.startup+0x160): undefined reference to `sum(int, int)'
collect2: error: ld returned 1 exit status