| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1092197 | vjudge1 | Cezar (COCI16_cezar) | C++17 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define forn(i,a,b) for(int i = a; i < b; i++)
const int MAXN = 100;
const int MAXL = 26;
struct Word{
string str;
ll ord;
Word(ll ord, string str) : ord(ord), str(str) {}
};
bool cmp(const Word &a, const Word &b) {
if(a.ord<b.ord) return true;
return false;
}
ll n;
string strs[MAXN];
ll ord[MAXN];
bool menor[MAXL][MAXL]; // menor[i][j] = true -> si i < j
int main(){
cin>>n;
forn(i,0,n) cin>>strs[i];
forn(i,0,n) cin>>ord[i];
vector<Word> sorted;
forn(i,0,n) sorted.pb(Word(i,strs[ord[i]-1]));
sort(ALL(sorted),cmp);
forn(i,0,n){
forn(j,i+1,n){
string a,b; a = sorted[i].str; b = sorted[j].str;
//cout<<a<<" "<<b<<'\n';
forn(h,0,SZ(a)){
if(h>=SZ(b)){
cout<<"NE\n";
return 0;
}
if(a[h]==b[h]) continue;
menor[a[h]-'a'][b[h]-'a']=true;
//cout<<a[h]<<" "<<b[h]<<'\n';
if(menor[b[h]-'a'][a[h]-'a']){
cout<<"NE\n";
return 0;
}
break;
}
}
}
vector<bool> used(MAXL,false);
vector<char> dicc(MAXL);
forn(i,0,MAXL){
bool puede = true;
forn(j,0,MAXL){
puede=true;
if(used[j]) puede = false;
forn(h,0,MAXL){
if(menor[h][j]) puede = false;
}
if(puede){ dicc[j]=i+'a'; used[j]=true; forn(h,0,MAXL){menor[j][h]=false;} break; }
else if(!used[j]){
//cout<<j<<" no pudo en "<<i<<'\n';
}
}
if(!puede){
cout<<"NE\n";
return 0;
}
}
cout<<"DA\n";
forn(i,0,SZ(dicc)) cout<<dicc[i]; cout<<'\n';
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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
