Submission #1167928

#TimeUsernameProblemLanguageResultExecution timeMemory
1167928CrabCNH별들과 삼각형 (IZhO11_triangle)C++20
100 / 100
446 ms23328 KiB
#include <bits/stdc++.h> #define task "BriantheCrab" #define int long long #define pii pair <int, int> #define fi first #define se second #define szf sizeof #define sz(s) (int)((s).size()) using namespace std; template <class T> void mini (T &t, T f) {if (t > f) t = f;} template <class T> void maxi (T &t, T f) {if (t < f) t = f;} const int maxN = 1e5 + 5; const int inf = 1e18 + 7; const int mod = 1e9 + 7; map <pii, int> mp; map <int, int> t1, t2; void solve () { int n; cin >> n; for (int i = 1; i <= n; i ++) { int x, y; cin >> x >> y; mp[{x, y}] ++; } for (auto [a, _] : mp) { auto [x, y] = a; t1[x] ++; t2[y] ++; } int res = 0; for (auto [a, _] : mp) { auto [x, y] = a; res += (t1[x] - 1) * (t2[y] - 1); } cout << res; } signed main () { cin.tie (nullptr) -> sync_with_stdio (false); if (fopen (task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } int t = 1; //cin >> t; while (t --) { solve (); } return 0; } // thfdgb

Compilation message (stderr)

triangle.cpp: In function 'int main()':
triangle.cpp:48:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         freopen (task".inp", "r", stdin);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
triangle.cpp:49:17: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |         freopen (task".out", "w", stdout);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...