답안 #492715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
492715 2021-12-08T13:32:48 Z LittleCube Chess Rush (CEOI20_chessrush) C++14
컴파일 오류
0 ms 0 KB
//#include "arithmetics.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int N, R, C, c1, c2;
char c;

constexpr int P = 1e9 + 7;

int Add(int a, int b)
{
    int ret = a % P;
    ret = (ret < 0 ? P + ret : ret) + (b % P);
    return (ret >= 0 ? ret % P : ret + P);
}
int Sub(int a, int b)
{
    int ret = a % P;
    ret = (ret < 0 ? P + ret : ret) - (b % P);
    return (ret >= 0 ? ret % P : ret + P);
}
int Mul(int a, int b)
{
    int ret = (1ll * (a % P) * (b % P)) % P;
    return (ret < 0 ? P + ret : ret);
}
int modpow(int base, int exp, int modulus = P)
{
    base %= modulus;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = (1ll * result * base) % modulus;
        base = (1ll * base * base) % modulus;
        exp >>= 1;
    }
    return result;
}
int modinv(int a, int modulus = P)
{
    return modpow(a, modulus - 2);
}
int Div(int a, int b)
{
    int ret = b % P;
    ret = (1ll * (a % P) * modinv(ret < 0 ? P + ret : ret)) % P;
    return (ret < 0 ? P + ret : ret);
}

signed main()
{
    ios_base::sync_with_stdio(0), cin.tie(0);
    cin >> N >> R >> C;
    for (int i = 1; i <= N; i++)
    {
        cin >> c >> c1 >> c2;
        if(c == 'P')
            cout << (c1 == c2 ? "1 1\n" : "0 0\n");
        else if(c == 'R')
            cout << (c1 == c2 ? "1 1\n" : "2 2\n");
        else if(c == 'Q')
            cout << ((c1 == c2 || abs(c1 - c2) == R) ? "1 1\n" : "2 4\n");
    }
}

Compilation message

/usr/bin/ld: /tmp/ccDtw7jK.o: in function `Add(int, int)':
arithmetics.cpp:(.text+0x0): multiple definition of `Add(int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccDtw7jK.o: in function `Sub(int, int)':
arithmetics.cpp:(.text+0x80): multiple definition of `Sub(int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x80): first defined here
/usr/bin/ld: /tmp/ccDtw7jK.o: in function `Mul(int, int)':
arithmetics.cpp:(.text+0x100): multiple definition of `Mul(int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x100): first defined here
/usr/bin/ld: /tmp/ccDtw7jK.o: in function `modpow(int, int, int)':
arithmetics.cpp:(.text+0x190): multiple definition of `modpow(int, int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x190): first defined here
/usr/bin/ld: /tmp/ccDtw7jK.o: in function `modinv(int, int)':
arithmetics.cpp:(.text+0x1f0): multiple definition of `modinv(int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x1f0): first defined here
/usr/bin/ld: /tmp/ccDtw7jK.o: in function `Div(int, int)':
arithmetics.cpp:(.text+0x290): multiple definition of `Div(int, int)'; /tmp/cceGWHLL.o:chessrush.cpp:(.text+0x290): first defined here
collect2: error: ld returned 1 exit status