Submission #1093323

# Submission time Handle Problem Language Result Execution time Memory
1093323 2024-09-26T14:52:47 Z DennisTran 허수아비 (JOI14_scarecrows) C++17
0 / 100
74 ms 5468 KB
#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

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 time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 5468 KB Output isn't correct
2 Halted 0 ms 0 KB -