Submission #605370

#TimeUsernameProblemLanguageResultExecution timeMemory
605370Red_InsideSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
10 ms8304 KiB
// #include <bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back #define mp make_pair #define o cout<<"BUG"<<endl; #define FOR(i, j, n) for(int j = i; j < n; ++j) #define forn(i, j, n) for(int j = i; j <= n; ++j) #define nfor(i, j, n) for(int j = n; j >= i; --j) #define all(v) v.begin(), v.end() #define ld long double #define ull unsigned long long using namespace std; const int maxn=1e6+100,LOG=17,mod=1e9+7; int block = 226, timer = 0; const ld EPS = 1e-18; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define bt(i) (1 << (i)) #define int ll const int inf=2e18; #define y1 yy #define prev pre #define pii pair <int, int> int n, m, a[maxn], b[maxn], dp[1010][1010]; main() { IOS cin >> n >> m; forn(1, i, n) { cin >> a[i]; } forn(1, j, m) { cin >> b[j]; } forn(0, i, n + 1) { forn(0, j, m + 1) dp[i][j] = inf; } dp[1][1] = 0; forn(1, i, n) { forn(1, j, m) { if(i == 1 && j == 1) continue; dp[i][j] = min(dp[i - 1][j] + b[j], dp[i][j - 1] + a[i]); } } cout << dp[n][m]; }

Compilation message (stderr)

kyoto.cpp:33:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   33 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...