# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464613 | 2021-08-13T14:19:36 Z | aihay | Zamjena (COCI18_zamjena) | C++14 | 24 ms | 32228 KB |
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; #define int long long #define f first #define s second #define pb push_back #define pp push #define double long double #define ceil(x,y) (x/y)+(x%y!=0)*((double)(1.0*x/y)<0?0:1) #define floor(x,y) (x/y)+(x%y!=0)*((double)(1.0a*x/y)<0?-1:0) const int MAX=1e7; const int MOD=1e9+7; const int MAAX=1e18; int arr[500010],arr2[500010]; string s[500010],s2[500010]; map<string,int> mp; in main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int tc=1; //cin>>tc; while(tc--){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>s[i]; if(s[i][0]>='0'&&s[i][0]<='9'){ for(int j=0;j<s[i].size();j++){ arr[i]*=10; arr[i]+=s[i][j]-'0'; } s[i]=""; } else{ arr[i]=-1; } } for(int i=0;i<n;i++){ cin>>s2[i]; if(s2[i][0]>='0'&&s2[i][0]<='9'){ for(int j=0;j<s2[i].size();j++){ arr2[i]*=10; arr2[i]+=s2[i][j]-'0'; } s2[i]=""; } else{ arr2[i]=-1; } if(~arr2[i]&&~arr[i]) continue; if(~arr[i]){ arr2[i]=arr[i]; mp[s2[i]]=arr[i]; continue; } if(~arr2[i]){ arr[i]=arr2[i]; mp[s[i]]=arr[i]; continue; } } for(int i=0;i<n;i++){ if(arr2[i]==-1&&arr[i]==-1){ mp[s[i]]=1; mp[s2[i]]=1; arr[i]=1; arr2[i]=1; } if(arr[i]!=arr2[i]||arr[i]==-1||arr2[i]==-1){ cout<<"NE\n"; return 0; } } cout<<"DA\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 31564 KB | Output is correct |
2 | Correct | 20 ms | 31644 KB | Output is correct |
3 | Correct | 18 ms | 31600 KB | Output is correct |
4 | Correct | 18 ms | 31564 KB | Output is correct |
5 | Correct | 18 ms | 31640 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 31608 KB | Output is correct |
2 | Incorrect | 17 ms | 31636 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 31636 KB | Output is correct |
2 | Correct | 20 ms | 31632 KB | Output is correct |
3 | Incorrect | 17 ms | 31640 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 31624 KB | Output is correct |
2 | Correct | 18 ms | 31704 KB | Output is correct |
3 | Incorrect | 23 ms | 31756 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 32228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |