답안 #1000111

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000111 2024-06-16T16:45:14 Z Lcc735 장난감 기차 (IOI17_train) C++17
0 / 100
6 ms 1624 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);
    vector<int> ans(n);
    vector <set<int>> st(n);
    set<int> ch;
    for(int i=0;i<n;i++){
        st[u[i]].insert(v[i]);
        if(r[i]==1){
            ch.insert(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;
        }
    }
    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:20:23: warning: value computed is not used [-Wunused-value]
   20 |                 est[i]==0;
train.cpp:23:23: warning: value computed is not used [-Wunused-value]
   23 |                 est[i]==1;
train.cpp:26:23: warning: value computed is not used [-Wunused-value]
   26 |                 est[i]==2;
train.cpp:31:23: warning: value computed is not used [-Wunused-value]
   31 |                 est[i]==0;
train.cpp:34:23: warning: value computed is not used [-Wunused-value]
   34 |                 est[i]==1;
train.cpp:37:23: warning: value computed is not used [-Wunused-value]
   37 |                 est[i]==2;
train.cpp:49:23: warning: value computed is not used [-Wunused-value]
   49 |                 ans[i]==0;
train.cpp:52:23: warning: value computed is not used [-Wunused-value]
   52 |                 ans[i]==1;
train.cpp:57:31: warning: value computed is not used [-Wunused-value]
   57 |                         ans[i]==0;
train.cpp:58:31: warning: value computed is not used [-Wunused-value]
   58 |                         est[i]==0;
train.cpp:61:31: warning: value computed is not used [-Wunused-value]
   61 |                         ans[i]==1;
train.cpp:62:31: warning: value computed is not used [-Wunused-value]
   62 |                         est[i]==1;
train.cpp:67:31: warning: value computed is not used [-Wunused-value]
   67 |                         ans[i]==0;
train.cpp:68:31: warning: value computed is not used [-Wunused-value]
   68 |                         est[i]==0;
train.cpp:71:31: warning: value computed is not used [-Wunused-value]
   71 |                         ans[i]==1;
train.cpp:72:31: warning: value computed is not used [-Wunused-value]
   72 |                         est[i]==1;
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1116 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1372 KB Output is correct
2 Correct 4 ms 1372 KB Output is correct
3 Correct 4 ms 1392 KB Output is correct
4 Incorrect 4 ms 1372 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1624 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1372 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1116 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -