답안 #795974

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
795974 2023-07-28T02:39:09 Z NeroZein Chess Rush (CEOI20_chessrush) C++17
컴파일 오류
0 ms 0 KB
//#include "arithmetics.h"
#include "bits/stdc++.h"

using namespace std;

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);
}
 
int main() {
  ios::sync_with_stdio(false); 
  cin.tie(NULL); 
  int r, c, q;
  cin >> r >> c >> q;
  while (q--) {
    char p;
    int c1, c2;
    cin >> p >> c1 >> c2;
    if (p == 'P') {
      if (c1 == c2) {
        cout << 1 << ' ' << 1 << '\n';
      } else {
        cout << 0 << ' ' << 0 << '\n';
      }
    } 
    else if (p == 'R') {
      if (c1 == c2) {
        cout << 1 << ' ' << 1 << '\n';
      } else {
        cout << 2 << ' ' << 2 << '\n';
      }
    } 
    else if (p == 'Q') {
      if (c1 == c2) {
        cout << 1 << ' ' << 1 << '\n';
      } else {
        cout << 2 << ' ' << 4 + (((r - 1) - abs(c2 - c1)) % 2 == 0) << '\n';
      }
    } 
  }
  return 0; 
}

Compilation message

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