3981 | 2023. 03. 07 13:04:50 | nagytamas | Bejgli (80 pont) | cpp17 | Hibás válasz 70/80 | 34ms | 5572 KiB |
// bejgli.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <climits>
using namespace std;
int n, i,db,m,p,maxi,sz;
vector <int> x,v;
int main()
{
cin >> n;
x.resize(n + 1);
v.resize(n + 1);
for (i = 1; i <= n; ++i)
{
cin >> x[i];
}
for (i = 1; i <= n; ++i)
{
sz = x[i - 1];
if (i == 1)
{
m = x[i];
--m;
if (m == 0) ++db;
}
else if (m == 0)
{
++v[sz];
++db;
m = x[i];
--m;
}
else
{
--m;
}
}
if (m == 0) ++db;
cout << db << "\n";
maxi = INT_MIN;
for (i = 1; i <= v.size() - 1; ++i)
{
if (v[i] > maxi)
{
maxi = v[i];
p = i;
}
}
cout << p;
return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Részfeladat | Összpont | Teszt | Verdikt | Idő | Memória | ||
---|---|---|---|---|---|---|---|
base | 70/80 | ||||||
1 | Hibás válasz | 0/0 | 3ms | 1876 KiB | |||
2 | Elfogadva | 0/0 | 3ms | 2072 KiB | |||
3 | Elfogadva | 4/4 | 3ms | 2536 KiB | |||
4 | Elfogadva | 4/4 | 3ms | 2712 KiB | |||
5 | Elfogadva | 4/4 | 2ms | 2752 KiB | |||
6 | Részben helyes | 2/4 | 3ms | 2868 KiB | |||
7 | Részben helyes | 2/4 | 3ms | 3048 KiB | |||
8 | Részben helyes | 2/4 | 3ms | 3192 KiB | |||
9 | Elfogadva | 4/4 | 3ms | 3276 KiB | |||
10 | Részben helyes | 2/4 | 3ms | 3416 KiB | |||
11 | Elfogadva | 4/4 | 3ms | 3636 KiB | |||
12 | Elfogadva | 4/4 | 3ms | 3732 KiB | |||
13 | Elfogadva | 4/4 | 4ms | 3752 KiB | |||
14 | Elfogadva | 4/4 | 4ms | 3832 KiB | |||
15 | Elfogadva | 4/4 | 6ms | 4128 KiB | |||
16 | Elfogadva | 4/4 | 6ms | 4528 KiB | |||
17 | Elfogadva | 4/4 | 13ms | 4708 KiB | |||
18 | Részben helyes | 2/4 | 19ms | 5464 KiB | |||
19 | Elfogadva | 4/4 | 27ms | 5452 KiB | |||
20 | Elfogadva | 4/4 | 27ms | 5572 KiB | |||
21 | Elfogadva | 4/4 | 34ms | 5572 KiB | |||
22 | Elfogadva | 4/4 | 21ms | 5552 KiB |