Submission #1000377

# Submission time Handle Problem Language Result Execution time Memory
1000377 2024-06-17T10:47:02 Z vjudge1 Exam (eJOI20_exam) C++17
0 / 100
3 ms 604 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> vec1,vec2;
    for(int n1=n;n1>0;n1--)
    {
        int x;
        cin>>x;
        vec1.push_back(x);
    }
    for(int n1=n;n1>0;n1--)
    {
        int x;
        cin>>x;
        vec2.push_back(x);
    }
    if(n<=10)
    {
        int br=0;
        int ress=0;
        for(;br<1<<n;br++)
        {
            bool b[vec1.size()]={false};
            for(int i=0,br2=br;i<vec1.size();i++,br2=br2>>1)
            {
                if(br2&1==1)
                {
                    b[i]=true;
                }
            }
            int res=0;

            for(int i=0;i<vec1.size();i++)
            {

                if(b[i]==true)
                {
                    int maxx=vec1[i];
                    int j=i+1;
                    for(;j<vec1.size() && b[j]==true;j++)
                    {
                        maxx=max(maxx,vec1[j]);
                    }

                    j--;

                    for(int k=i;k<=j;k++)
                    {
                        if(vec2[k]==maxx)
                            res++;
                    }
                    i=j;


                }
                else
                {
                    if(vec1[i]==vec2[i])
                        res++;
                }
            }
            ress=max(ress,res);

        }
        cout<<ress;
    }

    return 0;
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:29:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for(int i=0,br2=br;i<vec1.size();i++,br2=br2>>1)
      |                                ~^~~~~~~~~~~~
exam.cpp:31:25: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   31 |                 if(br2&1==1)
      |                        ~^~~
exam.cpp:38:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int i=0;i<vec1.size();i++)
      |                         ~^~~~~~~~~~~~
exam.cpp:45:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |                     for(;j<vec1.size() && b[j]==true;j++)
      |                          ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -