Submission #778593

# Submission time Handle Problem Language Result Execution time Memory
778593 2023-07-10T12:54:40 Z Sandarach151 Carnival (CEOI14_carnival) C++17
20 / 100
95 ms 308 KB
#include<bits/stdc++.h>
using namespace std;

vector<vector<int>> func(vector<int> vect){
    if(vect.size()==1){
        vector<vector<int>> ans;
        vector<int> temp;
        temp.push_back(vect[0]);
        ans.push_back(temp);
        return ans;
    }
    else{
        int mid = vect.size()/2;
        vector<int> vect1;
        vector<int> vect2;
        for(int i=0; i<mid; i++){
            vect1.push_back(vect[i]);
        }
        for(int i=mid; i<vect.size(); i++){
            vect2.push_back(vect[i]);
        }
        vector<vector<int>> temp1 = func(vect1);
        vector<vector<int>> temp2 = func(vect2);
        for(int i=0; i<temp1.size(); i++){
            for(int j=0; j<temp2.size(); j++){
                if(temp2[j][0]!=-1){
                    cout << 2 << ' ' << temp1[i][0] << ' ' << temp2[j][0] << endl;
                    int a;
                    cin >> a;
                    if(a==1){
                        for(int k=0; k<temp2[j].size(); k++){
                            temp1[i].push_back(temp2[j][k]);
                        }
                        temp2[j][0]=-1;
                    }
                }
            }
        }
        for(int i=0; i<temp2.size(); i++){
            if(temp2[i][0]!=-1){
                temp1.push_back(temp2[i]);
            }
        }
        return temp1;
    }
}

int main(){
    int n;
    cin >> n;
    vector<vector<int>> ans;
    vector<int> people;
    for(int i=1; i<=n; i++){
        people.push_back(i);
    }
    ans = func(people);
    vector<int> finans(n+1);
    for(int i=0; i<ans.size(); i++){
        for(int j=0; j<ans[i].size(); j++){
            finans[ans[i][j]]=i+1;
        }
    }
    cout << 0;
    for(int i=1; i<=n; i++){
        cout << ' ' << finans[i];
    }
    return 0;
}

Compilation message

carnival.cpp: In function 'std::vector<std::vector<int> > func(std::vector<int>)':
carnival.cpp:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(int i=mid; i<vect.size(); i++){
      |                        ~^~~~~~~~~~~~
carnival.cpp:24:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int i=0; i<temp1.size(); i++){
      |                      ~^~~~~~~~~~~~~
carnival.cpp:25:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for(int j=0; j<temp2.size(); j++){
      |                          ~^~~~~~~~~~~~~
carnival.cpp:31:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                         for(int k=0; k<temp2[j].size(); k++){
      |                                      ~^~~~~~~~~~~~~~~~
carnival.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for(int i=0; i<temp2.size(); i++){
      |                      ~^~~~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:58:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     for(int i=0; i<ans.size(); i++){
      |                  ~^~~~~~~~~~~
carnival.cpp:59:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for(int j=0; j<ans[i].size(); j++){
      |                      ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 22 ms 300 KB Output is correct
3 Partially correct 58 ms 292 KB Partially correct
4 Partially correct 56 ms 300 KB Partially correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 2 ms 208 KB Output is correct
7 Correct 23 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 22 ms 296 KB Output is correct
3 Partially correct 38 ms 208 KB Partially correct
4 Partially correct 68 ms 296 KB Partially correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 5 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Partially correct 36 ms 292 KB Partially correct
4 Partially correct 65 ms 300 KB Partially correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 8 ms 308 KB Output is correct
7 Correct 25 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Partially correct 74 ms 208 KB Partially correct
4 Partially correct 95 ms 296 KB Partially correct
5 Correct 9 ms 308 KB Output is correct
6 Correct 21 ms 296 KB Output is correct
7 Correct 24 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 5 ms 304 KB Output is correct
3 Partially correct 44 ms 308 KB Partially correct
4 Partially correct 43 ms 304 KB Partially correct
5 Partially correct 30 ms 284 KB Partially correct
6 Partially correct 42 ms 304 KB Partially correct
7 Partially correct 45 ms 308 KB Partially correct