# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433655 | kiennguyen246 | Progression (NOI20_progression) | C++14 | 194 ms | 17648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/**
* \author Nguyen Duc Kien
* \date 20/06/2021
*/
///Task name
#define TASK ""
///-------------------------------------------///
#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n, a[maxn], Q;
struct query
{
int req, L, R, S, C;
void inp()
{
cin >> req >> L >> R;
if (req != 3) cin >> S >> C;
}
}q[maxn];
namespace Sub1
{
void Main()
{
int res = 1;
int d = 2;
a[n + 1] = 1e9 + 69;
for (int i = 2; i <= n; i ++)
{
if (a[i + 1] - a[i] == a[i] - a[i - 1]) d ++;
else res = max(res, d), d = 2;
}
bool f2 = 0;
for (int i = 1; i <= Q; i ++)
{
if (q[i].req == 2) f2 = 1;
else if (q[i].req == 3)
{
if (f2 == 0) cout << res << "\n";
else cout << n << "\n";
}
}
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cerr << "Processing...\n\n";
if (fopen(TASK".INP", "r"))
{
freopen(TASK".INP", "r", stdin);
// freopen(TASK".OUT", "w", stdout);
}
cin >> n >> Q;
for (int i = 1; i <= n; i ++) cin >> a[i];
bool all_1_n = 1;
bool no_change = 1;
for (int i = 1; i <= Q; i ++)
{
q[i].inp();
if (q[i].L != 1 || q[i].R != n) all_1_n = 0;
if (q[i].req != 3) no_change = 0;
}
// if (n <= 500) Sub2::Main();
// else if (all_1_n) Sub1::Main();
// else if (no_change) Sub3::Main();
Sub1::Main();
cerr << "\n\n-----------------\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |