提出 #72515888


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PII pair<ll,ll>
#define endl '\n'
#define all(x) x.begin(),x.end()
const int S = 1e6+50;
const ll INF = 0x3f3f3f3f3f3f3f3fLL;
ll ma[S];
set<char>st1, st2;

void solve(){
	ll n, m;
	cin >> n >> m;
	char c;
	for(int i = 1; i <= n; i++){
		cin >> c;
		st1.insert(c);
	}
	for(int i = 1; i <= m; i++){
		cin >> c;
		st2.insert(c);
	}
	ll t;
	cin >> t;
	while(t--){
		string s1;
		cin >> s1;
		bool p1 = true;
		bool p2 = true;
		for(int i = 0; i < s1.size(); i++){
			if(st1.find(s1[i]) == st1.end()){
				p1 = false;
			}
		}
		for(int i = 0; i < s1.size(); i++){
			if(st2.find(s1[i]) == st2.end()){
				p2 = false;
			}
		}
		if(p1 && !p2){
			cout << "Takahashi" << endl;
			continue;
		}
		if(!p1 && p2){
			cout << "Aoki" << endl;
			continue;
		}
		cout << "Unknown" << endl;
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr),cout.tie(nullptr);
	ll t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
    return 0;
}

提出情報

提出日時
問題 B - Two Languages
ユーザ persuade123456
言語 C++23 (GCC 15.2.0)
得点 200
コード長 1064 Byte
結果 AC
実行時間 1 ms
メモリ 3624 KiB

コンパイルエラー

./Main.cpp: In function 'void solve()':
./Main.cpp:31:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                 for(int i = 0; i < s1.size(); i++){
      |                                ~~^~~~~~~~~~~
./Main.cpp:36:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |                 for(int i = 0; i < s1.size(); i++){
      |                                ~~^~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 15
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3444 KiB
00_sample_01.txt AC 1 ms 3624 KiB
00_sample_02.txt AC 1 ms 3608 KiB
01_random_03.txt AC 1 ms 3536 KiB
01_random_04.txt AC 1 ms 3568 KiB
01_random_05.txt AC 1 ms 3604 KiB
01_random_06.txt AC 1 ms 3448 KiB
01_random_07.txt AC 1 ms 3568 KiB
01_random_08.txt AC 1 ms 3604 KiB
01_random_09.txt AC 1 ms 3604 KiB
01_random_10.txt AC 1 ms 3444 KiB
01_random_11.txt AC 1 ms 3536 KiB
01_random_12.txt AC 1 ms 3448 KiB
01_random_13.txt AC 1 ms 3444 KiB
01_random_14.txt AC 1 ms 3604 KiB