답안 #779017

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
779017 2023-07-11T06:30:45 Z vjudge1 Zamjena (COCI18_zamjena) C++17
14 / 70
12 ms 2380 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define int long long int
#define pb push_back
#define N 105
map<string,string> mp;
map<string,int> var;
signed main(){
	lalala;
	int n;cin>>n;
	vector<string> bir, iki;
	for(int i=0;i<n;i++){
		string str;cin>>str;
		bir.pb(str);
		int ok=1;
		for(int i=0;i<str.length();i++){
			if((str[i]-'0')>9){ok=0;break;}
		}
		if(ok){
			mp[str]=str;
		}
		else{
			mp[str]="&&";
		}
		var[str]=1;
	}
	int yes=1;
	for(int i=0;i<n;i++){
		string str;cin>>str;
		iki.pb(str);
		int ok=1;
		for(int i=0;i<str.length();i++){
			if((str[i]-'0')>9){ok=0;break;}
		}
		if(ok){
			mp[str]=str;
		}
		else{
			if(var[str]==0)mp[str]="&&";
		}var[str]=1;
		if(mp[iki[i]]==mp[bir[i]])continue;
		if(mp[iki[i]]=="&&")mp[iki[i]]=mp[bir[i]];
		if(mp[bir[i]]=="&&")mp[bir[i]]=mp[iki[i]];
		if(mp[bir[i]]!=mp[iki[i]])yes=0;

	}


	if(yes)cout<<"DA"<<endl;
	else cout<<"NE"<<endl;


}

Compilation message

zamjena.cpp: In function 'int main()':
zamjena.cpp:18:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for(int i=0;i<str.length();i++){
      |               ~^~~~~~~~~~~~~
zamjena.cpp:34:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for(int i=0;i<str.length();i++){
      |               ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 1 ms 468 KB Output is correct
3 Incorrect 4 ms 980 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 2380 KB Output isn't correct
2 Halted 0 ms 0 KB -