| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 210004 | kshitij_sodani | Dango Maker (JOI18_dango_maker) | C++17 | 498 ms | 44536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef int64_t llo;
#define a first
#define b second
#define endl "\n"
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
int it[n][m];
char s;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>s;
if(s=='R'){
it[i][j]=0;
}
else if(s=='G'){
it[i][j]=1;
}
else{
it[i][j]=2;
}
}
}
int tot=0;
for(int ii=0;ii<n+m-1;ii++){
vector<pair<int,int>> aa;
for(int jj=0;jj<ii+1;jj++){
int i,j;
j=jj;
i=ii-j;
int co=0;
int co2=0;
if(i>=n or j>=m){
continue;
}
int st=1;
int stt=1;
if(j>0 and it[i][j-1]==0 and j+1<m and it[i][j+1]==2 and it[i][j]==1){
co+=1;
}
if(i>0 and i+1<n and it[i-1][j]==0 and it[i+1][j]==2 and it[i][j]==1){
co2+=1;
}
aa.pb({co,co2});
}
pair<int,int> dp[aa.size()];
dp[0]=aa[0];
for(int k=1;k<aa.size();k++){
dp[k]=dp[k-1];
if(aa[k].a==1){
dp[k].a+=1;
if(k>1){
dp[k].a=max(dp[k].a,dp[k-2].b+1);
}
}
if(aa[k].b==1){
dp[k].b+=1;
if(k>1){
dp[k].b=max(dp[k].b,dp[k-2].a+1);
}
}
}
tot+=max(dp[aa.size()-1].a,dp[aa.size()-1].b);
}
cout<<tot<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
