Submission #1120564

#TimeUsernameProblemLanguageResultExecution timeMemory
1120564vjudge1KOVANICE (COI15_kovanice)C++17
Compilation error
0 ms0 KiB
// Telebe of adicto yani AzeTurk810 /* Author: AzeTurk810 Licance: open source(only authors name must be in code) Begin Time:11/20/2024 20:48 Problem link: https://codeforces.com/problemset/problem/1543/D1 */ #include <iostream> #include <vector> #include <algorithm> #include <set> #include <cmath> using namespace std; using ll= long long; using ull=unsigned long long; # define vint vector<int> //# define endl '\n' # define range(a,b,c) for(int i=a;i<b;i+=c) # define arange(a,b,c) for(int i=a;i>b;i-=c) # define bend(x) (x).begin(),(x).end() # define pb push_back # define fori(x) for(int i=0;i<x;i++) # define forj(y) for(int j=0;j<y;j++) # define forn(x,c) for(int i=0;i<n;i+=c) # define ff first # define ss second # define INF 1e14 # define printfprs(v) for(int alma = 0;alma<(v).size();alma++){cout<<(v)[alma].ff<< ' '<<(v)[alma].ss<<endl;}; //# define int long long int n,q,c,cases =0; int temp; const int MAXN = 50005; bool check(string s) { string sc = s; reverse(sc.begin(),sc.end()); return sc == s; } signed main() { ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n,m,last,v,l,r; char c; cin>>n>>m>>v; vector<int>coins(m + 1,-1); vector<pair<int,int>>beraber_sulh; for(int i=0;i<v;i++) { cin>>l;cin>>c;cin>>r; if(c == '=') { beraber_sulh.pb({l,r}); // beraber_sulh.pb({r,l}); //cout<<l<<endl; } else { coins[l] = 1; coins[r] = 2; //cout<<l<< ' '<<r; } } sort(beraber_sulh.begin(),beraber_sulh.end());int cnt = 1000; while(cnt--){}for(int i=0;i<beraber_sulh.size();i++) { if(coins[beraber_sulh[i].ss] != -1) { coins[beraber_sulh[i].ff] = coins[beraber_sulh[i].ss]; } else if( coins[beraber_sulh[i].ff ]!=-1) { coins[beraber_sulh[i].ss ]= coins[beraber_sulh[i].ff] ; } }for(int i=beraber_sulh.size() - 1;i>=0;i--) { if(coins[beraber_sulh[i].ss] != -1) { coins[beraber_sulh[i].ff] = coins[beraber_sulh[i].ss]; } else if( coins[beraber_sulh[i].ff ]!=-1) { coins[beraber_sulh[i].ss ]= coins[beraber_sulh[i].ff] ; } }} for(int i=0;i<beraber_sulh.size();i++) { if(coins[beraber_sulh[i].ss] != -1) { coins[beraber_sulh[i].ff] = coins[beraber_sulh[i].ss]; } else if( coins[beraber_sulh[i].ff ]!=-1) { coins[beraber_sulh[i].ss ]= coins[beraber_sulh[i].ff] ; } }for(int i=beraber_sulh.size() - 1;i>=0;i--) { if(coins[beraber_sulh[i].ss] != -1) { coins[beraber_sulh[i].ff] = coins[beraber_sulh[i].ss]; } else if( coins[beraber_sulh[i].ff ]!=-1) { coins[beraber_sulh[i].ss ]= coins[beraber_sulh[i].ff] ; } } for(int i=1;i<=m;i++) { if(coins[i]!= -1) { cout<<'K'<<coins[i]<<endl; } else { cout<<'?'<<endl; } } }

Compilation message (stderr)

kovanice.cpp: In function 'int main()':
kovanice.cpp:69:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |     while(cnt--){}for(int i=0;i<beraber_sulh.size();i++)
      |                               ~^~~~~~~~~~~~~~~~~~~~
kovanice.cpp:47:13: warning: unused variable 'last' [-Wunused-variable]
   47 |     int n,m,last,v,l,r;
      |             ^~~~
kovanice.cpp: At global scope:
kovanice.cpp:90:5: error: expected unqualified-id before 'for'
   90 |     for(int i=0;i<beraber_sulh.size();i++)
      |     ^~~
kovanice.cpp:90:17: error: 'i' does not name a type
   90 |     for(int i=0;i<beraber_sulh.size();i++)
      |                 ^
kovanice.cpp:90:39: error: 'i' does not name a type
   90 |     for(int i=0;i<beraber_sulh.size();i++)
      |                                       ^
kovanice.cpp:100:6: error: expected unqualified-id before 'for'
  100 |     }for(int i=beraber_sulh.size() - 1;i>=0;i--)
      |      ^~~
kovanice.cpp:100:40: error: 'i' does not name a type
  100 |     }for(int i=beraber_sulh.size() - 1;i>=0;i--)
      |                                        ^
kovanice.cpp:100:45: error: 'i' does not name a type
  100 |     }for(int i=beraber_sulh.size() - 1;i>=0;i--)
      |                                             ^
kovanice.cpp:111:5: error: expected unqualified-id before 'for'
  111 |     for(int i=1;i<=m;i++)
      |     ^~~
kovanice.cpp:111:17: error: 'i' does not name a type
  111 |     for(int i=1;i<=m;i++)
      |                 ^
kovanice.cpp:111:22: error: 'i' does not name a type
  111 |     for(int i=1;i<=m;i++)
      |                      ^
kovanice.cpp:122:1: error: expected declaration before '}' token
  122 | }
      | ^