Submission #908871

# Submission time Handle Problem Language Result Execution time Memory
908871 2024-01-17T00:56:15 Z vjudge1 Carnival (CEOI14_carnival) C++17
0 / 100
14 ms 344 KB
#include<bits/stdc++.h>
using namespace std;

int n;
int ans[160];   
vector<int>primos;
bool vis[200005];

void criba(){
        for(int i=2; i<200; i++){
            if(!vis[i]){
                primos.push_back(i);
                for(int j=i*i; j<=200; j+=i)vis[j]=1;
            }
        }
}

int main(){
    cin >> n; int x; int cont=1; int crep=0;
    primos.push_back(1);
    criba();
    for(auto i:primos){
       for(int j=1; j+i<=n; j++){
           
           cout << 2 << " " << j << " " << j+i << endl;  crep++;
           cin >> x; 
           if(x==1){
               if(ans[j] && ans[j+i]){
                    ans[j] =min(ans[j], ans[j+i]);
                    ans[j+i] = ans[j];
               }  
               else{
                   if(ans[j])ans[j+i] = ans[j];
                   else if(ans[j+i])ans[j] = ans[j+i];
                   else {
                       ans[j] = cont;
                       ans[j+i] = cont; 
                   }
               }
               cont++;
           }else{
               if(ans[j]==0) ans[j] = cont++; 
               if(ans[j+i]==0)ans[j+i] = cont++;
           }
       } 
    }
    cout << 0 << " ";
    for(int i=1; i<=n; i++)cout << ans[i] << " ";
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 344 KB Integer 12 violates the range [1, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 344 KB Integer 6 violates the range [1, 5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Incorrect 12 ms 344 KB Integer 11 violates the range [1, 8]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 344 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 344 KB Output is correct
2 Incorrect 14 ms 344 KB Integer 20 violates the range [1, 17]
3 Halted 0 ms 0 KB -