제출 #111409

#제출 시각아이디문제언어결과실행 시간메모리
111409ecasdqinaBoat (APIO16_boat)C++14
9 / 100
6 ms4480 KiB
#include <bits/stdc++.h> using namespace std::literals::string_literals; using i64 = long long; using std::cout; using std::endl; using std::cin; template<typename T> std::vector<T> make_v(size_t a){return std::vector<T>(a);} template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){ return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); } int main() { int n; scanf("%d", &n); std::vector<int> a(n), b(n); for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]); const int MOD = 1e9 + 7; auto dp = make_v<i64>(n + 1, n + 1); dp[0][0] = 1; for(int i = 0; i < n; i++) { assert(a[i] == b[i]); for(int j = 0; j < i + 1; j++) dp[i + 1][j] = dp[i][j]; for(int j = 0; j < i + 1; j++) { if(j and a[j - 1] >= a[i]) continue; dp[i + 1][i + 1] += dp[i][j]; dp[i + 1][i + 1] %= MOD; } } i64 ans = 0; for(int i = 1; i < dp[n].size(); i++) (ans += dp[n][i]) %= MOD; printf("%lld\n", ans); return 0; }

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

boat.cpp: In function 'int main()':
boat.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < dp[n].size(); i++) (ans += dp[n][i]) %= MOD;
                 ~~^~~~~~~~~~~~~~
boat.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n); std::vector<int> a(n), b(n);
         ~~~~~^~~~~~~~~~
boat.cpp:18:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < n; i++) scanf("%d%d", &a[i], &b[i]);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...