Submission #966403

#TimeUsernameProblemLanguageResultExecution timeMemory
966403antonChess Rush (CEOI20_chessrush)C++17
13 / 100
15 ms16324 KiB
#include<bits/stdc++.h> #include "arithmetics.h" using namespace std; #define pii pair<int, int> typedef complex<int> point; const int MAX_C= 100; const int MAX_R =100; pii dp[MAX_C][MAX_C][MAX_R]; void chmax(pii& a, pii& b){ if(b.first<a.first){ a= b; } else if(b.first == a.first){ a.second = Add(a.second, b.second); } } signed main(){ cin.tie(NULL); ios_base::sync_with_stdio(false); int r, c, q; cin>>r>>c>>q; for(int fin= 0; fin<c; fin++){ dp[fin][0][fin] = {0, 1}; for(int line = 1; line<r; line++){ for(int j= 0; j<c; j++){ dp[fin][line][j] = dp[fin][line-1][j]; if(j>0){ chmax(dp[fin][line][j], dp[fin][line-1][j-1]); } if(j<c-1){ chmax(dp[fin][line][j], dp[fin][line-1][j+1]); } dp[fin][line][j].first++; } } } for(int i = 0; i<q; i++){ char p; cin>>p; int begin, dest; cin>>begin>>dest; begin--; dest--; if(p == 'K'){ cout<<dp[dest][r-1][begin].first<<" "<<dp[dest][r-1][begin].second<<endl; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...