제출 #150490

#제출 시각아이디문제언어결과실행 시간메모리
150490PedroBigManZamjena (COCI18_zamjena)C++14
0 / 70
11 ms3372 KiB
#include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=a; i<b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define INF ((ll) pow(2,63) -1) ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} bool E(string a, string b) { if(a.size()!=b.size()) {return false;} REP(i,0,a.size()) {if(a[i]!=b[i]) {return false;}} return true; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll N; cin>>N; vector<pl> a; vector<pl> b; string s; bool isint; ll cur; map<string,ll> code; vector< vector<ll> > posA,posB; vector<ll> xx; REP(i,0,2*N) {posA.pb(xx); posB.pb(xx);} REP(i,0,N) { cin>>s; isint=true; cur=0; REP(j,0,s.size()) { if((((ll) s[j]) < 48) || (((ll) s[j]) > 57)) {isint=false;} cur+=(pow(10,s.size()-j-1))*(((ll) s[j]) - 48); } if(isint) {a.pb(mp(1,cur));} else { if(code.count(s)>0) {a.pb(mp(0,code[s]));} else {code[s]=code.size()-1; a.pb(mp(0,code.size()-1));} posA[code[s]].pb(i); } } REP(i,0,N) { cin>>s; isint=true; cur=0; REP(j,0,s.size()) { if((((ll) s[j]) < 48) || (((ll) s[j]) > 57)) {isint=false;} cur+=(pow(10,s.size()-j-1))*(((ll) s[j]) - 48); } if(isint) {b.pb(mp(1,cur));} else { if(code.count(s)>0) {b.pb(mp(0,code[s]));} else {code[s]=code.size()-1; b.pb(mp(0,code.size()-1));} posB[code[s]].pb(i); } } ll ind,val,ind1,ind2; REP(i,0,N) { if(a[i].ff==0 && b[i].ff==0) { ind1=a[i].ss; ind2=b[i].ss; REP(j,0,posA[ind1].size()) {a[posA[ind1][j]].ss=ind2; posA[ind2].pb(posA[ind1][j]);} posA[ind1].clear(); REP(j,0,posB[ind1].size()) {b[posB[ind1][j]].ss=ind2; posB[ind2].pb(posB[ind1][j]);} posB[ind1].clear(); } else if(a[i].ff==0 && b[i].ff==1) { ind = a[i].ss; val=b[i].ss; REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;} posA[ind].clear(); REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;} posB[ind].clear(); } else if(a[i].ff==1 && b[i].ff==0) { ind = b[i].ss; val=a[i].ss; REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;} posA[ind].clear(); REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;} posB[ind].clear(); } else if(a[i].ff==1 && b[i].ff==1) { if(a[i].ss!=b[i].ss) {cout<<"NE"<<endl; return 0;} } } cout<<"DA"<<endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

zamjena.cpp: In function 'void Out(std::vector<long long int>)':
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:20:29:
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                             ~~~~~~~~~~~~
zamjena.cpp:20:25: note: in expansion of macro 'REP'
 void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
                         ^~~
zamjena.cpp: In function 'bool E(std::__cxx11::string, std::__cxx11::string)':
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:25:9:
     REP(i,0,a.size()) {if(a[i]!=b[i]) {return false;}}
         ~~~~~~~~~~~~             
zamjena.cpp:25:5: note: in expansion of macro 'REP'
     REP(i,0,a.size()) {if(a[i]!=b[i]) {return false;}}
     ^~~
zamjena.cpp: In function 'int main()':
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:41:13:
         REP(j,0,s.size()) 
             ~~~~~~~~~~~~         
zamjena.cpp:41:9: note: in expansion of macro 'REP'
         REP(j,0,s.size()) 
         ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:59:13:
         REP(j,0,s.size()) 
             ~~~~~~~~~~~~         
zamjena.cpp:59:9: note: in expansion of macro 'REP'
         REP(j,0,s.size()) 
         ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:80:17:
             REP(j,0,posA[ind1].size()) {a[posA[ind1][j]].ss=ind2; posA[ind2].pb(posA[ind1][j]);}
                 ~~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:80:13: note: in expansion of macro 'REP'
             REP(j,0,posA[ind1].size()) {a[posA[ind1][j]].ss=ind2; posA[ind2].pb(posA[ind1][j]);}
             ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:82:17:
             REP(j,0,posB[ind1].size()) {b[posB[ind1][j]].ss=ind2; posB[ind2].pb(posB[ind1][j]);}
                 ~~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:82:13: note: in expansion of macro 'REP'
             REP(j,0,posB[ind1].size()) {b[posB[ind1][j]].ss=ind2; posB[ind2].pb(posB[ind1][j]);}
             ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:88:17:
             REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;}
                 ~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:88:13: note: in expansion of macro 'REP'
             REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;}
             ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:90:17:
             REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;}
                 ~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:90:13: note: in expansion of macro 'REP'
             REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;}
             ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:96:17:
             REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;}
                 ~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:96:13: note: in expansion of macro 'REP'
             REP(j,0,posA[ind].size()) {a[posA[ind][j]].ff=1; a[posA[ind][j]].ss=val;}
             ^~~
zamjena.cpp:11:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define REP(i,a,b) for(ll i=a; i<b; i++)
zamjena.cpp:98:17:
             REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;}
                 ~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:98:13: note: in expansion of macro 'REP'
             REP(j,0,posB[ind].size()) {b[posB[ind][j]].ff=1; b[posB[ind][j]].ss=val;}
             ^~~
#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...