結果
問題 | No.536 人工知能 |
ユーザー |
![]() |
提出日時 | 2017-06-30 22:45:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 1,329 ms |
コンパイル使用メモリ | 160,600 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 20:43:46 |
合計ジャッジ時間 | 1,608 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <bits/stdc++.h>using namespace std;struct UnionFind{vector< int > data;UnionFind(int sz){data.assign(sz, -1);}bool unite(int x, int y){x = find(x), y = find(y);if(x == y) return (false);if(data[x] > data[y]) swap(x, y);data[x] += data[y];data[y] = x;return (true);}int find(int k){if(data[k] < 0) return (k);return (data[k] = find(data[k]));}int size(int k){return (-data[find(k)]);}};typedef long long int64;void solve(){string S;cin >> S;if(*--S.end() == 'i' && *-- --S.end() == 'a') cout << S.substr(0, S.size() - 2) + "AI" << endl;else cout << S + "-AI" << endl;}int main(){cin.tie(0);ios::sync_with_stdio(false);solve();}