結果

問題 No.1439 Let's Compare!!!!
ユーザー Example0911Example0911
提出日時 2021-03-26 21:48:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 500 ms / 2,000 ms
コード長 1,137 bytes
コンパイル時間 4,089 ms
コンパイル使用メモリ 208,776 KB
実行使用メモリ 19,468 KB
最終ジャッジ日時 2023-08-19 15:15:00
合計ジャッジ時間 7,279 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,500 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 9 ms
4,380 KB
testcase_08 AC 13 ms
4,384 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 500 ms
19,028 KB
testcase_11 AC 416 ms
12,596 KB
testcase_12 AC 406 ms
12,460 KB
testcase_13 AC 496 ms
19,468 KB
testcase_14 AC 489 ms
19,388 KB
testcase_15 AC 372 ms
8,824 KB
testcase_16 AC 330 ms
8,360 KB
testcase_17 AC 316 ms
8,392 KB
testcase_18 AC 290 ms
8,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 1000000007;



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	string S, T; cin >> S >> T;
	vector<int>s(N), t(N);
	for (int i = 0; i < N; i++) {
		s[i] = S[i] - '0';
		t[i] = T[i] - '0';
	}
	int Q; cin >> Q;
	vector<int>a(N, 0);
	set<pair<int, int>>st;
	for (int i = 0; i < N; i++) {
		if (s[i] < t[i]) {
			a[i] = -1;
			st.insert({ i, -1 });
		}
		else if(s[i] > t[i]) {
			a[i] = 1;
			st.insert({ i, 1 });
		}
	}
	for (int _ = 0; _ < Q; _++) {
		char c; cin >> c;
		int x, y; cin >> x >> y; x--;
		int tmp = a[x];
		if (c == 'S') {
			s[x] = y;
		}
		else {
			t[x] = y;
		}
		if(tmp != 0)st.erase({ x, tmp });
		if (s[x] < t[x]) {
			a[x] = -1;
			st.insert({ x, -1 });

		}
		else if (s[x] > t[x]) {
			a[x] = 1;
			st.insert({ x, 1 });
		}
		else a[x] = 0;
		if (st.empty())cout << "=" << endl;
		else {
			auto itr = st.begin();
			pair<int, int> p = *itr;
			if (p.second == 1)cout << ">" << endl;
			else cout << "<" << endl;
		}
	}
	return 0;
}
0