# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1002486 | 2024-06-19T15:14:42 Z | TitanicXDzz | Pilot (NOI19_pilot) | C++14 | 140 ms | 8132 KB |
#include<bits/stdc++.h> using namespace std; int a[1000010]; int l[1000010]; int r[1000010]; int dp[100010]; priority_queue<pair<int,int>> pq; int main(){ int n,q; cin>>n>>q; l[0]=-1; r[0]=1; l[n+1]=n; r[n+1]=n+2; int maxi=0; for(int i=1;i<=n;i++){ cin>>a[i]; l[i]=i-1; r[i]=i+1; pq.push({-a[i],-i}); if(a[i]>maxi) maxi=a[i]; } int sumi=0; while(pq.empty()==0){ int x=pq.top().first; int y=pq.top().second; pq.pop(); int g=(r[-y]-r[-y-1])*(l[-y+1]-l[-y]); sumi+=g; l[r[-y-1]]=l[-y+1]; r[l[-y+1]]=r[-y-1]; dp[-x]=sumi; } for(int i=1;i<=1000000;i++){ if(dp[i]==0) dp[i]=dp[i-1]; } for(int i=0;i<q;i++){ int ans; cin>>ans; cout<<dp[ans]<<endl; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 6352 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 138 ms | 7828 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 140 ms | 8132 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4184 KB | Output is correct |
2 | Correct | 2 ms | 4188 KB | Output is correct |
3 | Correct | 2 ms | 4188 KB | Output is correct |
4 | Correct | 2 ms | 4188 KB | Output is correct |
5 | Incorrect | 2 ms | 4196 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |