Submission
Status:
----P-----
Subtask/Task Score:
10/100
Score: 10
User: TonnamSora
Problemset: Croissant Express
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-11 23:49:58
#include <iostream>
using namespace std;
int main(){
int n, t, e;
cin >> n >> t >> e;
int a[n], b[n];
int checka[n] = {0}, checkb[n] = {0};
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
int checkt = -1;
int checke = 1;
int boret = 0;
int boree = 0;
int sumt = 0;
long long int producte = 1;
for(int i = 0; i < n; i++){
if(checkt == -1){
if(a[i] <= 0){
continue;
}
boret++;
sumt = sumt + a[i];
checka[i] = 1;
//cout << a[i] << " " << sumt << "\n";
}
else if(checkt == 1){
if(b[i] <= 0){
continue;
}
boret++;
sumt = sumt + b[i];
checkb[i] = 1;
//cout << b[i] << " " << sumt << "\n";
}
if(boret % t == 0){
boret = 0;
checkt = checkt * -1;
}
}
for(int i = 0; i < n; i++){
if(checke == -1){
if(a[i] <= 0){
continue;
}
boree++;
producte = producte * a[i] % 10007;
checka[i] = 1;
}
else if(checke == 1){
if(b[i] <= 0){
continue;
}
boree++;
producte = producte * b[i] % 10007;
checkb[i] = 1;
}
if(boree % e == 0){
boree = 0;
checke = checke * -1;
}
}
int maxa = 0;
int cnta = 0;
int maxb = 0;
int cntb = 0;
for(int i = 0; i < n; i++){
if(checka[i] == 0){
cnta++;
}
if(checka[i] == 1){
cnta = 0;
}
if(cnta > maxa){
maxa = cnta;
}
//cout << cnta << "\n";
}
for(int i = 0; i < n; i++){
if(checkb[i] == 0){
cntb++;
}
if(checkb[i] == 1){
cntb = 0;
}
if(cntb > maxb){
maxb = cntb;
}
}
int maxim = max(maxa, maxb);
cout << sumt << " " << producte % 10007 << " " << maxim;
}