답안 #817818

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
817818 2023-08-09T17:03:27 Z YassirSalama Fountain (eJOI20_fountain) C++17
0 / 100
20 ms 5984 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <limits>
#include <map>
#include <utility>
#include <cctype>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <functional>
#include <iterator>
using namespace std;
#define OVL(x,s) for(auto y:x) cout<<y<<s; cout<<"\n";
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__);
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define ll long long
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define int long long
const int MAXN=2e5;
const int LOGN=20;
int n;
int up[MAXN][LOGN];
int arr[MAXN];
int tree[4*MAXN];
void build(int node,int l,int r){
	if(l==r) {
		tree[node]=arr[l];
		return;
	}
	int mid=(l+r)/2;
	build(node<<1,l,mid);
	build(node<<1|1,mid+1,r);
	tree[node]=max(tree[node<<1],tree[node<<1|1]);
}
int query(int node,int l,int r,int ql,int x){
	if(l==r){
		return (tree[node]>x&&l>=ql)?l:n+1;
	}
	int mid=(l+r)/2;
	if(ql<=mid){
		int left=query(node<<1,l,mid,ql,x);
		if(left==n+1) 
			return query(node<<1|1,mid+1,r,ql,x);
		return left;
	}
	return query(node<<1|1,mid+1,r,ql,x);
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int q;
cin>>n>>q;
int v[MAXN+1];
for(int i=1;i<=n;i++){
	cin>>arr[i]>>v[i];
}
build(1,1,n);
for(int i=1;i<=n;i++){
	int x=query(1,1,n,i,arr[i]);
	// dbg(i,x);
}

}

Compilation message

fountain.cpp: In function 'int main()':
fountain.cpp:71:6: warning: unused variable 'x' [-Wunused-variable]
   71 |  int x=query(1,1,n,i,arr[i]);
      |      ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 5984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1876 KB Output isn't correct
2 Halted 0 ms 0 KB -