제출 #1247834

#제출 시각아이디문제언어결과실행 시간메모리
1247834shiori_chan마스코트 (JOI13_mascots)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <random> #include <algorithm> #include <chrono> #define all(x) x.begin(), x.end() #define fi first #define se second #define compact(v) v.erase(unique(all(v)) , v.end()) #define pi pair<int , int> #define vi vector<int> #define FOR(i , l , r) for(int i = l; i <= r; ++ i) using namespace std; typedef long long ll; #define int long long const int nd = 3001 , mod = 1e9 + 7; int mul(int a , int b) {return (a * b) % mod;} int add(int a , int b) {return (a + b) % mod;} mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int> dist(1 , (int)2e9); int f[nd * 3000]; int dp[nd][nd]; void solve(){ int r , c; cin >> r >> c; int n; cin >> n; int cnt = 0; pair<int , int> s = {INT_MAX , INT_MAX} , t = {-1 , -1}; FOR(i , 1 , n){ int x , y; cin >> x >> y; s = min(s , {x , y}) , t = max(t , {x , y}); ++ cnt; } int x = t.fi - s.fi + 1 , y = t.se - s.se + 1; dp[x][y] = f[x * y - cnt]; FOR(i , x , r){ FOR(j , y , c){ if(i == x && j == y) continue; dp[i][j] = add(mul(dp[i - 1][j] , f[j]) , mul(dp[i][j - 1] , f[i])); //cout << i << " " << j << " " << dp[i][j] << '\n'; } } cout << mul(2 , dp[r][c]) << '\n'; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); #define task "task" if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } f[0] = 1; for(int i = 1;i < nd * 3000; ++ i) f[i] = mul(i , f[i - 1]); solve(); return 0; }

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

mascots.cpp: In function 'void solve()':
mascots.cpp:33:30: error: 'INT_MAX' was not declared in this scope
   33 |         pair<int , int> s = {INT_MAX , INT_MAX} , t = {-1 , -1};
      |                              ^~~~~~~
mascots.cpp:6:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    5 | #include <chrono>
  +++ |+#include <climits>
    6 | #define all(x) x.begin(), x.end()
mascots.cpp:33:47: error: could not convert '{<expression error>, INT_MAX}' from '<brace-enclosed initializer list>' to 'std::pair<long long int, long long int>'
   33 |         pair<int , int> s = {INT_MAX , INT_MAX} , t = {-1 , -1};
      |                                               ^
      |                                               |
      |                                               <brace-enclosed initializer list>
mascots.cpp: In function 'int main()':
mascots.cpp:61:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |                 freopen(task".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
mascots.cpp:62:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   62 |                 freopen(task".out", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~