Cod sursa(job #2974533)
Utilizator | Data | 4 februarie 2023 10:17:22 | |
---|---|---|---|
Problema | Lupul Urias si Rau | Scor | 8 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include <fstream>
using namespace std;
ifstream c1in("lupu.in");
ofstream c1out("lupu.out");
int x,y,n,l1,l2,s,i,V[100001];
int main()
{c1in>>n>>l1>>l2;
for (i=1;i<=n;i++)
{c1in>>x>>y;
if (x<=l1 && y>V[x/l2+1]) s-=V[x/l2+1],V[x/l2+1]=y,s+=y;
}
c1out<<s;
return 0;
}