Submission #1093323

#TimeUsernameProblemLanguageResultExecution timeMemory
1093323DennisTran허수아비 (JOI14_scarecrows)C++17
0 / 100
74 ms5468 KiB
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define FOD(i, a, b) for (int i = (a); i >= (b); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define ALL(x) (x).begin(), (x).end() #define __Dennis_Tran___ signed main() #define TIME (1.0 * clock() / CLOCKS_PER_SEC) #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } using namespace std; const int maxN = 2e5 + 5; int n; pair <int, int> a[maxN]; int dd[2002][2002]; __Dennis_Tran___{ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> n; FOR(i, 1, n) cin >> a[i].first >> a[i].second; sort(a + 1, a + n + 1); vector <int> nen; FOR(i, 1, n) nen.emplace_back(a[i].second); sort(ALL(nen)); FOR(i, 1, n) a[i].second = lower_bound(ALL(nen), a[i].second) - nen.begin() + 1; long long ans = 0; FOR(i, 1, n) { vector <int> val; int j = i; while (j <= n && a[j].first == a[i].first) val.emplace_back(a[j++].second); i = j - 1; sort(ALL(val)); REP(i, val.size()) FOR(j, i + 1, val.size() - 1) ans += dd[val[i]][val[j]]++; } cout << ans; cerr << "Time elapsed: " << TIME << " s.\n"; return (0 ^ 0); }

Compilation message (stderr)

scarecrows.cpp: In function 'int main()':
scarecrows.cpp:4:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    4 | #define REP(i, n) for (int i = 0; i < (n); i++)
      |                                     ^
scarecrows.cpp:39:9: note: in expansion of macro 'REP'
   39 |         REP(i, val.size()) FOR(j, i + 1, val.size() - 1)
      |         ^~~
scarecrows.cpp:2:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define FOR(i, a, b) for (int i = (a); i <= (b); i++)
      |                                          ^
scarecrows.cpp:39:28: note: in expansion of macro 'FOR'
   39 |         REP(i, val.size()) FOR(j, i + 1, val.size() - 1)
      |                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...