제출 #1120580

#제출 시각아이디문제언어결과실행 시간메모리
1120580vjudge1KOVANICE (COI15_kovanice)C++17
50 / 100
499 ms5312 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int sz=2e6+5; const int INF=1e18; const int MOD=1e9+7; int arr[sz],res[sz]; void solve() { vector<pair<int,int>> equalities; int n,m,v; cin>>n>>m>>v; for(int i=0;i<v;i++) { int a,b; char c; cin>>a>>c>>b; if(c=='=') equalities.push_back({a,b}); else { if(c=='<') { res[a]=1; res[b]=2; } else { res[a]=2; res[b]=1; } } } for(int l=0;l<100;l++) { for(int i=0;i<equalities.size();i++) { int a=equalities[i].first; int b=equalities[i].second; if(res[a]!=res[b]) { if(res[a]!=0 && res[b]!=0) { res[a]=0; res[b]=0; } else if(res[a]==0) res[a]=res[b]; else res[b]=res[a]; } } } for(int i=1;i<=m;i++) { if(res[i]==0) cout<<'?'<<endl; else cout<<'K'<<res[i]<<endl; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--) { solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

kovanice.cpp: In function 'void solve()':
kovanice.cpp:54:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for(int i=0;i<equalities.size();i++)
      |                     ~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...