Submission #472174

# Submission time Handle Problem Language Result Execution time Memory
472174 2021-09-13T08:51:51 Z morasha3 Political Development (BOI17_politicaldevelopment) C++17
0 / 100
1870 ms 524292 KB
#include<bits/stdc++.h>
typedef long long ll;
const ll mod = (ll) 1e9 + 7;
const ll mx = (ll) 1e5 +7;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,ans=0;
    cin>>n>>k;
    ll arr[n];
    vector<vector<ll>>v(n);
    for(int i=0; i<n; i++)
    {
        ll a;
        cin>>a;
        arr[i]=a;
        for(int j=0; j<a; j++)
        {
            ll b;
            cin>>b;
            v[i].push_back(b);
            ans=2;
        }
    }
    map<pair<ll,ll>,ll>m;
    for(int i=0; i<n; i++)
    {

            for(int h=0; h<arr[i]; h++)
            {
                ll y=v[i][h],t=i;
                m[ {v[i][h],i}]=1;
            }

    }
    for(int i=0; i<n; i++)
    {
            vector<ll>e;

        for(int j=0; j<arr[i]; j++)
        {
            ll cnt=1;
            bool f=1;
            ll c=e.size();
            ll y=v[i][j],t=0;

            for(int h=0; h<e.size(); h++)
            {
                 y=v[i][j],t=e[h];
                if(m[ {v[i][j],e[h]}]==1)
                {
                    if(f)
                    {
                        cnt++;
                        f=0;
                    }
                    cnt++;
                }
            }
            e.push_back(v[i][j]);
            ans=max(ans,cnt);
        }
    }
    cout<<ans;

}


Compilation message

politicaldevelopment.cpp: In function 'int main()':
politicaldevelopment.cpp:34:20: warning: unused variable 'y' [-Wunused-variable]
   34 |                 ll y=v[i][h],t=i;
      |                    ^
politicaldevelopment.cpp:34:30: warning: unused variable 't' [-Wunused-variable]
   34 |                 ll y=v[i][h],t=i;
      |                              ^
politicaldevelopment.cpp:50:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |             for(int h=0; h<e.size(); h++)
      |                          ~^~~~~~~~~
politicaldevelopment.cpp:47:16: warning: unused variable 'c' [-Wunused-variable]
   47 |             ll c=e.size();
      |                ^
politicaldevelopment.cpp:48:16: warning: variable 'y' set but not used [-Wunused-but-set-variable]
   48 |             ll y=v[i][j],t=0;
      |                ^
politicaldevelopment.cpp:48:26: warning: variable 't' set but not used [-Wunused-but-set-variable]
   48 |             ll y=v[i][j],t=0;
      |                          ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 13 ms 1904 KB Output is correct
4 Runtime error 1870 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 13 ms 1904 KB Output is correct
4 Runtime error 1870 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 13 ms 1904 KB Output is correct
4 Runtime error 1870 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 13 ms 1904 KB Output is correct
4 Runtime error 1870 ms 524292 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -