제출 #1120392

#제출 시각아이디문제언어결과실행 시간메모리
1120392vjudge1KOVANICE (COI15_kovanice)C++17
0 / 100
527 ms13748 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ld double const int INF = 1e18; const int mod = 12345; const int sz = 4e3 + 5; signed main() { ios_base::sync_with_stdio(0);cin.tie(0); int n , m , v; cin >> n >> m >> v; vector < string > q1; vector < string > q2; for(int i = 1;i <= v;i++) { string s; cin >> s; bool f = 0; for(char c : s) { if(c == '=') { f = 1; q2.push_back(s); continue; } } if(!f) q1.push_back(s); } vector < int > ans(m + 1 , -1); for(int i = 0;i < q1.size();i++) { string s = q1[i]; string r1 = ""; string r2 = ""; int in = -1; char q; for(int j = 0;j < s.size();j++) { if(s[j] == '>' or s[j] == '<') { in = j; q = s[j]; break; } r1 += s[j]; } for(int j = in + 1;j < s.size();j++) r2 += s[j]; int x1 = stoi(r1); int x2 = stoi(r2); if(q == '<') { ans[x1] = 1; ans[x2] = 2; } else { ans[x1] = 2; ans[x2] = 1; } } for(int i = 0;i < q2.size();i++) { string s = q2[i]; string r1 = ""; string r2 = ""; int in = -1; for(int j = 0;j < s.size();j++) { if(s[j] == '=') { in = j; break; } r1 += s[j]; } for(int j = in + 1;j < s.size();j++) r2 += s[j]; int x1 = stoi(r1); int x2 = stoi(r2); if(ans[x1] != -1) { ans[x2] = ans[x1]; } else if(ans[x2] != -1) { ans[x1] = ans[x2]; } } for(int i = 1;i <= m;i++) { if(ans[i] == -1) { cout << "?" << endl; continue; } cout << 'K' << ans[i] << endl; } }

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

kovanice.cpp: In function 'int main()':
kovanice.cpp:36:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |    for(int i = 0;i < q1.size();i++)
      |                  ~~^~~~~~~~~~~
kovanice.cpp:43:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |        for(int j = 0;j < s.size();j++)
      |                      ~~^~~~~~~~~~
kovanice.cpp:53:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |        for(int j = in + 1;j < s.size();j++) r2 += s[j];
      |                           ~~^~~~~~~~~~
kovanice.cpp:67:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |    for(int i = 0;i < q2.size();i++)
      |                  ~~^~~~~~~~~~~
kovanice.cpp:73:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |        for(int j = 0;j < s.size();j++)
      |                      ~~^~~~~~~~~~
kovanice.cpp:82:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |        for(int j = in + 1;j < s.size();j++) r2 += s[j];
      |                           ~~^~~~~~~~~~
kovanice.cpp:56:8: warning: 'q' may be used uninitialized in this function [-Wmaybe-uninitialized]
   56 |        if(q == '<')
      |        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...