# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1079983 | 2024-08-29T05:27:58 Z | Trumling | 말 (IOI15_horses) | C++14 | 1500 ms | 12412 KB |
#include "horses.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define all(x) x.begin(),x.end() #define INF 9999999999999999 #define MOD 1000000007 typedef long long ll; ll n; vector<int>sell; vector<int>x,y; int init(int N, int X[], int Y[]) { n=N; ll curr=1; for(int i=0;i<n;i++) { x.pb(X[i]); y.pb(Y[i]); } bool mod=0; for(int i=n-1;i>=0;i--) { if(sell.empty() || !mod && y[sell[sell.size()-1]]*curr < y[i]) { sell.pb(i); curr=1; mod=0; } curr*=x[i]; if(curr>=MOD) { curr%=MOD; mod=1; } } for(int i=0;i<sell.size()/2;i++) swap(sell[i],sell[sell.size()-1-i]); //for(int i=0;i<sell.size();i++) //cout<<sell[i]<<' '; ll idx=0; ll ans=0; curr=1; for(int i=0;i<n;i++) { curr*=x[i]; curr%=MOD; if(sell[idx]==i) { ans+=(curr*y[i])%MOD; ans%=MOD; idx++; curr=0; } } return ans; } int updateX(int pos, int val) { ll curr=1; x[pos]=val; sell.clear(); bool mod=0; for(int i=n-1;i>=0;i--) { if(sell.empty() || !mod && y[sell[sell.size()-1]]*curr < y[i]) { sell.pb(i); curr=1; mod=0; } curr*=x[i]; if(curr>=MOD) { mod=1; curr%=MOD; } } for(int i=0;i<sell.size()/2;i++) swap(sell[i],sell[sell.size()-1-i]); //for(int i=0;i<sell.size();i++) //cout<<sell[i]<<' '; ll idx=0; ll ans=0; curr=1; for(int i=0;i<n;i++) { curr*=x[i]; curr%=MOD; if(sell[idx]==i) { ans+=(curr*y[i])%MOD; ans%=MOD; idx++; curr=0; } } return ans; } int updateY(int pos, int val) { ll curr=1; y[pos]=val; sell.clear(); bool mod=0; for(int i=n-1;i>=0;i--) { if(sell.empty() || !mod && y[sell[sell.size()-1]]*curr < y[i]) { sell.pb(i); curr=1; mod=0; } curr*=x[i]; if(curr>=MOD) { mod=1; curr%=MOD; } } for(int i=0;i<sell.size()/2;i++) swap(sell[i],sell[sell.size()-1-i]); //for(int i=0;i<sell.size();i++) //cout<<sell[i]<<' '; ll idx=0; ll ans=0; curr=1; for(int i=0;i<n;i++) { curr*=x[i]; curr%=MOD; if(sell[idx]==i) { ans+=(curr*y[i])%MOD; ans%=MOD; idx++; curr=0; } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 360 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 1 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 408 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 1 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 9 ms | 348 KB | Output is correct |
24 | Correct | 8 ms | 348 KB | Output is correct |
25 | Correct | 10 ms | 348 KB | Output is correct |
26 | Correct | 10 ms | 488 KB | Output is correct |
27 | Correct | 9 ms | 348 KB | Output is correct |
28 | Correct | 9 ms | 348 KB | Output is correct |
29 | Correct | 8 ms | 468 KB | Output is correct |
30 | Correct | 9 ms | 344 KB | Output is correct |
31 | Correct | 8 ms | 344 KB | Output is correct |
32 | Correct | 8 ms | 476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1514 ms | 8416 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 600 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 0 ms | 348 KB | Output is correct |
22 | Correct | 1 ms | 348 KB | Output is correct |
23 | Correct | 8 ms | 348 KB | Output is correct |
24 | Correct | 8 ms | 348 KB | Output is correct |
25 | Correct | 10 ms | 348 KB | Output is correct |
26 | Correct | 10 ms | 344 KB | Output is correct |
27 | Correct | 8 ms | 344 KB | Output is correct |
28 | Correct | 9 ms | 444 KB | Output is correct |
29 | Correct | 8 ms | 348 KB | Output is correct |
30 | Correct | 9 ms | 444 KB | Output is correct |
31 | Correct | 8 ms | 344 KB | Output is correct |
32 | Correct | 8 ms | 480 KB | Output is correct |
33 | Execution timed out | 1588 ms | 12412 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 596 KB | Output is correct |
4 | Correct | 0 ms | 420 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 1 ms | 348 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 348 KB | Output is correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 8 ms | 348 KB | Output is correct |
24 | Correct | 8 ms | 348 KB | Output is correct |
25 | Correct | 10 ms | 488 KB | Output is correct |
26 | Correct | 10 ms | 348 KB | Output is correct |
27 | Correct | 8 ms | 468 KB | Output is correct |
28 | Correct | 9 ms | 472 KB | Output is correct |
29 | Correct | 8 ms | 348 KB | Output is correct |
30 | Correct | 9 ms | 484 KB | Output is correct |
31 | Correct | 8 ms | 348 KB | Output is correct |
32 | Correct | 8 ms | 348 KB | Output is correct |
33 | Execution timed out | 1592 ms | 10432 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |