Submission #813270

# Submission time Handle Problem Language Result Execution time Memory
813270 2023-08-07T14:52:27 Z hariaakas646 A Huge Tower (CEOI10_tower) C++17
100 / 100
98 ms 10640 KB
#include <bits/stdc++.h>

using namespace std;

#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

const lli mod = 1e9 + 9;

int main()
{
    int n;
    lli d;
    scd(n);
    sclld(d);

    vll vec(n);
    frange(i, n) sclld(vec[i]);
    sort(all(vec));

    int i1 = 0;
    int i2 = 0;
    lli tot = 1;
    while (i1 < n)
    {
        while (vec[i1] - vec[i2] > d)
            i2++;
        tot = tot * (i1 - i2 + 1);
        tot %= mod;
        i1++;
    }
    printf("%lld", tot);
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:5:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 | #define scd(t) scanf("%d", &t)
      |                ~~~~~^~~~~~~~~~
tower.cpp:33:5: note: in expansion of macro 'scd'
   33 |     scd(n);
      |     ^~~
tower.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
tower.cpp:34:5: note: in expansion of macro 'sclld'
   34 |     sclld(d);
      |     ^~~~~
tower.cpp:6:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 | #define sclld(t) scanf("%lld", &t)
      |                  ~~~~~^~~~~~~~~~~~
tower.cpp:37:18: note: in expansion of macro 'sclld'
   37 |     frange(i, n) sclld(vec[i]);
      |                  ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 596 KB Output is correct
2 Correct 8 ms 1192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 2260 KB Output is correct
2 Correct 38 ms 4664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 5140 KB Output is correct
2 Correct 98 ms 10640 KB Output is correct