제출 #1357834

#제출 시각아이디문제언어결과실행 시간메모리
1357834NewtonabcBOI Acronym (BOI25_boi)C++20
100 / 100
56 ms14284 KiB
#include<bits/stdc++.h>
using namespace std;
const int N=2e3+10;
int oc[N][N];
int n,b[N];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            cin>>oc[i][j];
        }
    }
    vector<int> ans;
    int l=0,r=n-1;
    while(oc[l][r]==oc[l+1][r]) l++;
    while(oc[l][r]==oc[l][r-1]) r--;
    ans.push_back(l);
    for(int i=l+1;i<r;i++){
        bool bl=oc[l][i-1]!=oc[l+1][i-1];
        bool br=oc[i+1][r]!=oc[i+1][r-1];
        //if false means B not dominant (<=)
        //use (l+1,i) and (i,r-1) to make literally dominant >0<
        if(bl){
            if(oc[l][i]==oc[l][i-1]+1) ans.push_back(i);
            continue;
        }
        if(br){
            if(oc[i][r]==oc[i+1][r]+1) ans.push_back(i);
            continue;
        }
        if(oc[l+1][i-1]==oc[l+1][i] && oc[i][r-1]==oc[i+1][r-1]) ans.push_back(i);
    }
    if(r!=l) ans.push_back(r);
    for(auto x:ans) cout<<x+1 <<" ";
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…