제출 #1159342

#제출 시각아이디문제언어결과실행 시간메모리
1159342shnChess Rush (CEOI20_chessrush)C++20
컴파일 에러
0 ms0 KiB
// #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(){ int r , c , q; cin >> r >> c >> q; while(q--){ char tt; cin >> tt; if(tt == 'P'){ int x , y; cin >> x >> y; if(x != y){ cout << 0 << '\n'; continue; } cout << "1 1\n"; } else if(tt == 'R'){ int x , y; cin >> x >> y; if(x == y){ cout << "1 1\n"; continue; } cout << "2 2\n"; } else{ int x , y; cin >> x >> y; if(x == y || abs(x - y) == abs(1 - r)){ cout << "1 1\n"; continue; } int ans = 2; for(int j = 1; j <= c; j++){ if(j == x){ // int x2 = r - abs(j - y); // if() continue; } int x2 = 1 + abs(j - x); if(abs(x2 - r) == abs(j - y)) ans = Add(ans , 1); if(x2 == r) ans = Add(ans , 1); if(j == y) ans = Add(ans , 1); x2 = 1; if(abs(x2 - r) == abs(j - y)) ans = Add(ans , 1); if(j == y) ans = Add(ans , 1); } cout << 2 << ' ' << ans << '\n'; } } }

컴파일 시 표준 에러 (stderr) 메시지

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