답안 #479367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
479367 2021-10-11T13:40:46 Z Arvin Crossing (JOI21_crossing) C++11
0 / 100
47 ms 2228 KB
#include <bits/stdc++.h>

using namespace std;

#define ull unsigned long long
#define ll long long
#define ui unsigned int
#define us unsigned short
#define inf_int 1e9
#define inf_ll 1e18
#define mod 1000000007
#define smod 998244353

map<pair<char, char>, char> mp;

int main(){
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	
	mp[{'J', 'O'}] = mp[{'O', 'J'}] = 'I';
	mp[{'J', 'I'}] = mp[{'I', 'J'}] = 'O';
	mp[{'I', 'O'}] = mp[{'O', 'I'}] = 'J';
	
	int n;
	cin >> n;
	
	set<string> st;
	vector<string> v;
	
	for(int x=0;x<3;x++){
		string s;
		cin >> s;
		
		if(!st.count(s)){
			st.insert(s);
			v.push_back(s);
		}
	}
	
	for(int x=0;x<v.size();x++){
		for(int y=0;y<x;y++){
			string tmp;
			for(int z=0;z<v[x].length();z++){
				if(v[x][z] == v[y][z]){
					tmp.push_back(v[x][z]);
				} else {
					tmp.push_back(mp[{v[x][z], v[y][z]}]);
				}
			}
			
			if(!st.count(tmp)){
				st.insert(tmp);
				v.push_back(tmp);
			}
		}
	}
	
	int q;
	cin >> q;
	
	string t;
	cin >> t;
	
	if(st.count(t)){
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}
	
	for(int i=1;i<=q;i++){
		int l, r;
		char c;
		cin >> l >> r >> c;
		
		l--; r--;
		for(int x=l;x<=r;x++){
			t[x] = c;
		}
		
		if(st.count(t)){
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
	
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:41:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for(int x=0;x<v.size();x++){
      |              ~^~~~~~~~~
Main.cpp:44:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |    for(int z=0;z<v[x].length();z++){
      |                ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -