제출 #472212

#제출 시각아이디문제언어결과실행 시간메모리
472212BidoTeimaZamjena (COCI18_zamjena)C++17
0 / 70
2 ms332 KiB
/// isA AC #include <bits/stdc++.h> using namespace std; using ll = long long; void ACPLS(){ #ifndef ONLINE_JUDGE freopen("output.txt","w",stdout); freopen("input.txt","r",stdin); #endif ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } #define tc int tttttt;cin>>tttttt;while(tttttt--) #define sumrange(l,r,arr) (l==0?arr[r]:arr[r]-arr[l-1]) bool isint(string& s){ bool ok=1; for(char i:s) ok&=isdigit(i); return ok; } bool isseq(string& s){ return !isint(s); } int main(){ ACPLS(); int n; cin>>n; string a[n],b[n]; for(auto&i:a)cin>>i; for(auto&i:b)cin>>i; map<string,string>mp{}; for(int i = 0; i < n; i++){ if(isint(b[i])&&isseq(a[i])){ mp[a[i]]=b[i]; } else if(isint(a[i])&&isseq(b[i])){ mp[b[i]]=a[i]; } } bool ok = 1; for(int i = 0; i < n; i++){ if(isint(a[i])&&isint(b[i])){ ok&=a[i]==b[i]; } else if(isint(a[i])&&isseq(b[i])){ if(mp[b[i]].empty()) mp[b[i]]=a[i]; ok&=mp[b[i]]==a[i]; } else if(isint(b[i])&&isseq(a[i])){ if(mp[a[i]].empty()) mp[a[i]]=b[i]; ok&=mp[a[i]]==b[i]; } else{ if(mp[a[i]].empty()) mp[a[i]]=mp[b[i]]; else if(mp[b[i]].empty()){ mp[b[i]]=mp[a[i]]; } ok&=mp[a[i]]==mp[b[i]]; } } cout<<(ok?"DA":"NE"); }

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

zamjena.cpp: In function 'void ACPLS()':
zamjena.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
zamjena.cpp:8:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     freopen("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...