Submission #388208

# Submission time Handle Problem Language Result Execution time Memory
388208 2021-04-10T14:25:39 Z Jisan_1040 A Huge Tower (CEOI10_tower) C++14
0 / 100
223 ms 14400 KB
//Bismillahir Rahman-ir Rahim
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include<cstdio>
#include<cstring>
#include<string>
#include<stdlib.h>
#include<iomanip>

#define PI acos(-1)
#define F first
#define S second
#define debug(x)  cout<<'>'<<#x<<":"<<x<<endl
#define tara ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define Y printf("YES\n")
#define N printf("NO\n")
#define ll long long
#define lll __int128
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<long,long>
#define eb emplace_back
#define pb push_back
#define sc scanf
#define pf printf
#define endl '\n'
#define INF 1<<30
#define ll_INF 1LL<<62

const int M=1e5;


using namespace std ;


int main() {
	tara ;
	int n, d, i, j;
	cin>>n>>d ;
    int a[n+1] ;
	for(i=1; i<=n; i++)cin>>a[i] ;

	sort(a+1, a+n+1);
	ll st=1, ans=1;
	for(i=2; i<=n; i++) {
		while(st <= n && a[st]+d < a[i]) ++st;
            cout<<i<<" "<<st<<endl ;
            ans*= (i-st+1) % 1000000009;
	}
	cout<<ans<<endl;
}

Compilation message

tower.cpp: In function 'int main()':
tower.cpp:49:15: warning: unused variable 'j' [-Wunused-variable]
   49 |  int n, d, i, j;
      |               ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 316 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 444 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 464 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 146 ms 6888 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 14400 KB Output isn't correct
2 Halted 0 ms 0 KB -