Submission #83433

#TimeUsernameProblemLanguageResultExecution timeMemory
83433Leonardo_PaesCezar (COCI16_cezar)C++11
0 / 100
4 ms672 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,string> pis; #define MAXN 110 pis vet[MAXN]; int mat[26][26], mark[26]; stack<int> pilha; void dfs(int u){ mark[u]=1; for(int i=0; i<=25; i++){ if(mat[u][i]==1 and mark[i]==0){ dfs(i); } } pilha.push(u); } int main(){ int n; cin >> n; for(int i=1; i<=n; i++){ cin >> vet[i].second; } for(int i=1; i<=n; i++){ cin >> vet[i].first; } sort(vet+1, vet+n+1); for(int i=1; i<n; i++){ for(int j=i+1; j<=n; j++){ string a = vet[i].second; string b = vet[j].second; int siz = max(a.size(), b.size()); for(int k=0; k<siz; k++){ if(k+1==a.size() or k+1==b.size()){ break; } if(a[k] != b[k]){ mat[b[k]-'a'][a[k]-'a'] = 1; break; } } } } for(int i=0; i<=25; i++){ for(int j=0; j<=25; j++){ if(mat[i][j]==1 and mat[j][i]==1){ cout << "NE" << endl; return 0; } } } cout << "DA" << endl; for(int i=0; i<=25; i++){ if(mark[i]==0){ dfs(i); stack<int> pilha2; while(!pilha.empty()){ pilha2.push(pilha.top()); pilha.pop(); } while(!pilha2.empty()){ cout << char(pilha2.top() + (int)'a'); pilha2.pop(); } } } return 0; }

Compilation message (stderr)

cezar.cpp: In function 'int main()':
cezar.cpp:49:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(k+1==a.size() or k+1==b.size()){
        ~~~^~~~~~~~~~
cezar.cpp:49:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(k+1==a.size() or k+1==b.size()){
                         ~~~^~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...