結果
問題 |
No.3155 Same Birthday
|
ユーザー |
|
提出日時 | 2025-05-23 19:24:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 207 ms / 2,000 ms |
コード長 | 3,679 bytes |
コンパイル時間 | 2,486 ms |
コンパイル使用メモリ | 208,636 KB |
実行使用メモリ | 17,280 KB |
最終ジャッジ日時 | 2025-05-23 19:24:44 |
合計ジャッジ時間 | 8,479 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 49 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; double PI = acos(-1.0); #define sqr(x) ((ll)(x) * (x)) #define ff first #define ss second #define pb push_back #define srt(v) sort(v.begin(), v.end()) #define rsrt(v) sort(v.rbegin(), v.rend()) #define rvrs(v) reverse(v.begin(), v.end()) #define yes printf("YES\n") #define no printf("NO\n") #define pf1(a) printf("%lld", a) #define pf2(a, b) printf("%lld %lld", a, b) #define case(a) printf("Case %lld: ", a) #define ses printf("\n") #define CC(x) cout << "Case #" << ++x << ":"; #define LL_INF (1LL << 62) #define INF (1 << 30) #define SetBit(x, k) (x = (1LL << k)) #define ClearBit(x, k) (x &= ~(1LL << k)) #define CheckBit(x, k) ((x >> k) & 1) void substring(string s, int i, string cur) { if (i == s.size()) { cout << cur << endl; return; } substring(s, i + 1, cur + s[i]); substring(s, i + 1, cur); } ll ch2digit(char s) { char charvalue = s; ll number = (int(charvalue) + 0); return number - 97; } long long Sqrt(long long x) { long long l = 1, r = 1e9, ans = 0; while (l <= r) { long long mid = (l + r) >> 1; if (mid * mid <= x) { ans = mid; l = mid + 1; } else { r = mid - 1; } } return ans; } void permutaion(string s, int l, int r) { if (l == r) { cout << s << endl; return; } for (int i = l; i <= r; i++) { swap(s[l], s[i]); permutaion(s, l + 1, r); swap(s[l], s[i]); } } bool pallindrome(string s, int l, int r) { if (l >= r) return true; if (s[l] != s[r]) return false; return pallindrome(s, l + 1, r - 1); } char int2char(int N) { return char(N); } void numToBinRepresentation(ll n) { for (ll i = 15; i >= 0; --i) { // ll x = ((n>>i)&1); cout << ((n >> i) & 1); } cout << endl; } const ll P = 31; const ll MOD = 1e9 + 9; // Compute power of P vector<ll> computePowers(int n) { vector<ll> power(n); power[0] = 1; for (int i = 1; i < n; ++i) power[i] = (power[i - 1] * P) % MOD; return power; } // Compute prefix hash vector<ll> computePrefixHash(const string &s, const vector<ll>& power) { int n = s.size(); vector<ll> hash(n); hash[0] = (s[0] - 'a' + 1); for (int i = 1; i < n; ++i) { hash[i] = (hash[i - 1] + (s[i] - 'a' + 1) * power[i]) % MOD; } return hash; } // Get hash of substring [l, r] ll getSubHash(const vector<ll> &hash, const vector<ll> &power, int l, int r) { ll result = hash[r]; if (l > 0) result = (result - hash[l - 1] + MOD) % MOD; return (result * power[power.size() - 1 - l]) % MOD; // Normalize } bool isPalindrome(const string &s) { string rev = s; reverse(rev.begin(), rev.end()); int n = s.size(); auto power = computePowers(n + 1); auto hash1 = computePrefixHash(s, power); auto hash2 = computePrefixHash(rev, power); // Compare full normalized hashes ll hash_original = getSubHash(hash1, power, 0, n - 1); ll hash_reverse = getSubHash(hash2, power, 0, n - 1); return hash_original == hash_reverse; } void solve() { int n; cin>>n; vector<pair<int,int>>vp(n); map<pair<int,int>,int>mp; int flag = 0; for(auto &[x,y]:vp){ cin>>x>>y; mp[{x,y}]++; if(mp[{x,y}]>1)flag = 1; } if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); ll t = 1; // cin >> t; while (t--) { solve(); } }