Submission #49830

# Submission time Handle Problem Language Result Execution time Memory
49830 2018-06-03T11:42:51 Z A_H_Ghaznavi Alkemija (COCI18_alkemija) C++14
48 / 80
16 ms 5624 KB
// In the name of god
// A.H.Ghaznavi
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn=510;
int n,m,v1,r[maxn],l[maxn],k,x[maxn][maxn],y[maxn][maxn],ans[maxn];
bool mark[maxn],tf;
vector <int> v;
int main()
{
    cin>>n>>m;
    for (int i=1;i<=m;i++)
    {
        cin>>v1;
        mark[v1]=true;
    }
    cin>>k;
    for (int i=0;i<k;i++)
    {
        cin>>l[i]>>r[i];
        for (int i2=0;i2<l[i];i2++)
            cin>>x[i][i2];
        for (int i2=0;i2<r[i];i2++)
            cin>>y[i][i2];
    }
    for (int i=1;i<=n;i++)
    {
        for (int i2=0;i2<n;i2++)
        {
            tf=false;
            for (int i3=0;i3<l[i2];i3++)
            {
                if (!mark[x[i2][i3]])
                    tf=true;
            }
            if (!tf)
            {
                for (int i3=0;i3<r[i2];i3++)
                    mark[y[i2][i3]]=true;
            }
        }
    }
    for (int i=1;i<=n;i++)
    {
        if (mark[i])
            v.push_back(i);
    }
    for (int i=0;i<v.size();i++)
        ans[i]=v[i];
    sort(ans, ans+v.size());
    cout<<v.size()<<endl;
    for (int i=0;i<v.size();i++)
        cout<<ans[i]<<" ";
    return 0;
}

Compilation message

alkemija.cpp: In function 'int main()':
alkemija.cpp:50:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v.size();i++)
                  ~^~~~~~~~~
alkemija.cpp:54:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v.size();i++)
                  ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 4984 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 5184 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 5284 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 16 ms 5624 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -