Submission
Status:
PPP-PPP-PP
Subtask/Task Score:
80/100
Score: 80
User: TonnamSora
Problemset: Croissant Express
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-12 00:01:42
#include <iostream>
using namespace std;
int main(){
long long int n, t, e;
cin >> n >> t >> e;
long long int a[n], b[n];
long long int checka[n] = {0}, checkb[n] = {0};
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
}
long long int checkt = -1;
long long int checke = 1;
long long int boret = 0;
long long int boree = 0;
long long 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]) % 10007;
checka[i] = 1;
//cout << a[i] << " " << sumt << "\n";
}
else if(checkt == 1){
if(b[i] <= 0){
continue;
}
boret++;
sumt = (sumt + b[i]) % 10007;
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;
}
}
long long int maxa = 0;
long long int cnta = 0;
long long int maxb = 0;
long long 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;
}
}
long long int maxim = max(maxa, maxb);
cout << sumt % 10007 << " " << producte % 10007 << " " << maxim;
}