Submission #624685

# Submission time Handle Problem Language Result Execution time Memory
624685 2022-08-08T15:28:19 Z kkkkkkkk Fancy Fence (CEOI20_fancyfence) C++14
27 / 100
25 ms 3788 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long n,najg_visina=0,vk_sirina=0,najg_sirina=0;
    cin >> n;
    long long modul=pow(10,9)+7;
    long long h[n],w[n];
    for (int i=0;i<n;i++)
    {
        cin >> h[i];
        najg_visina=max(h[i],najg_visina);
    }
    for (int i=0;i<n;i++)
    {
        cin >> w[i];
        vk_sirina+=w[i];
        vk_sirina=vk_sirina%modul;
        najg_sirina=max(najg_sirina,w[i]);
    }
    long long vk=0;
    if (najg_sirina==1)
    {
        int str1=1; //sirina
        while (str1<=vk_sirina)
        {
            for (int i=0;i<n-str1+1;i++)
            {
                long long najniska=h[i];
                for (int j=i;j<i+str1;j++)
                    najniska=min(najniska,h[j]);
                //cout << najniska << endl;
                vk+=((najniska*(najniska+1))/2)%modul;
            }
            //cout << "za sirina " << str1 << " ima " << vk << " pravoagolnici" << endl;
            str1++;
        }
        cout << vk;
    }
    else
    {
        long long p=(vk_sirina*(vk_sirina+1)/2);
        p=p%modul;
        long long p2=(najg_visina*(najg_visina+1)/2);
        p2=p2%modul;
        cout << (p*p2)%modul << endl;
    }
 
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 584 KB Output is correct
3 Correct 10 ms 2004 KB Output is correct
4 Correct 21 ms 3760 KB Output is correct
5 Correct 25 ms 3788 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -