답안 #1000122

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000122 2024-06-16T17:01:25 Z Lcc735 장난감 기차 (IOI17_train) C++17
0 / 100
6 ms 1884 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
    int n=size(a);
    int m=size(u);
    vector<int> ans(n);
    vector <set<int>> st(n);
    set<int> ch;
    for(int i=0;i<n;i++){
        if(r[i]==1){
            ch.insert(i);
        }
    }
    for(int i=0;i<m;i++){
        if(u[i]==n-1){
            if(v[i]==0){
                st[u[i]].insert(n);
            }
        }
        else{
            st[u[i]].insert(v[i]);
        }
    }
    vector<int> est(n);
    for (int i=0;i<n;i++){
        if(a[i]==0){
            if((st[i].count(i)==1)&&(ch.count(i)==0)){
                est[i]=0;
                
            }
            else if((st[i].count(i+1)==0)&&(ch.count(i)==1)){
                est[i]=1;
            }
            else{
                est[i]=2;
            }
        }
        else{
            if((st[i].count(i+1)==0)&&(ch.count(i)==0)){
                est[i]=0;
                
            }
            else if((st[i].count(i)==1)&&(ch.count(i)==1)){
                est[i]=1;
            }
            else{
                est[i]=2;
            }
        }
    }
    int rep=0;
    if(count(est.begin(),est.end(),2)==n){
        rep=1;
    }
    for (int i=0;i<n;i++){
        if(rep==0){
            if(est[i]==0){
                ans[i]==0;
            }
            else if(est[i]==1){
                ans[i]==1;
            }
            else{
                for(int j=i;j<n;j++){
                    if(est[j]==0){
                        ans[i]==0;
                        est[i]==0;
                        
                    }
                    else if(est[j]==1){
                        ans[i]==1;
                        est[i]==1;
                    }
                }
                for(int j=0;j<i;j++){
                    if(est[j]==0){
                        ans[i]==0;
                        est[i]==0;
                        
                    }
                    else if(est[j]==1){
                        ans[i]==1;
                        est[i]==1;
                    }
                }
            }
        }
        else{
            ans[i]=1;
        }
        cout<<ans[i];
    }
    return ans;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:60:23: warning: value computed is not used [-Wunused-value]
   60 |                 ans[i]==0;
train.cpp:63:23: warning: value computed is not used [-Wunused-value]
   63 |                 ans[i]==1;
train.cpp:68:31: warning: value computed is not used [-Wunused-value]
   68 |                         ans[i]==0;
train.cpp:69:31: warning: value computed is not used [-Wunused-value]
   69 |                         est[i]==0;
train.cpp:73:31: warning: value computed is not used [-Wunused-value]
   73 |                         ans[i]==1;
train.cpp:74:31: warning: value computed is not used [-Wunused-value]
   74 |                         est[i]==1;
train.cpp:79:31: warning: value computed is not used [-Wunused-value]
   79 |                         ans[i]==0;
train.cpp:80:31: warning: value computed is not used [-Wunused-value]
   80 |                         est[i]==0;
train.cpp:84:31: warning: value computed is not used [-Wunused-value]
   84 |                         ans[i]==1;
train.cpp:85:31: warning: value computed is not used [-Wunused-value]
   85 |                         est[i]==1;
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1112 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1884 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1880 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1884 KB secret mismatch
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1112 KB secret mismatch
2 Halted 0 ms 0 KB -