Submission #685168

#TimeUsernameProblemLanguageResultExecution timeMemory
685168edogawa_somethingChecker (COCI19_checker)C++17
0 / 110
646 ms54088 KiB
#include<bits/stdc++.h> #include<chrono> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef string st; typedef bool bl; typedef vector<ll> vii; typedef pair<ll,ll> pii; typedef vector<pii> vpi; #define pu push #define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> #define fast ios_base::sync_with_stdio(0);cin.tie(); #define test ll qqqqq;cin>>qqqqq;while(qqqqq--) #define F first #define S second #define forn(i,n) for(ll i=0;i<n;i++) #define forx(i,j,n) for(ll i=j;i<n;i++) #define pb push_back #define pob pop_back #define all(v) v.begin(),v.end() #define lb lower_bound #define ub upper_bound #define pof pop_front #define pow powww #define prtll(x) printf("%lld",x) #define prtld(x) printf("%Lf",x) #define prtst(x) printf("%s",x) #define prtch(x) printf("%c",x) #define measure chrono::high_resolution_clock::now() const ll dx[]{1,0,-1,0}; const ll dy[]{0,-1,0,1}; const ll inf=2e18; const ll mod=1e9+7; const ll LM=2e7+1; const ll M=3e6+1; const ll MM=1002; const ll MMM=501; const ld pi=acos(-1); //const ll mod=998244353; ll pow(ll r,ll to,ll m=mod){ ll res=1; while(to){ if((to&1)){ res*=r,res%=mod; } r*=r,r%=mod; to=(to>>1); } return res; } ll n; st s; map<pii,ll>mp; int main(){ fast cin>>n; cin>>n; cin>>s; forn(i,s.size()-1){ mp[{i+1,i+2}]=mp[{i+2,i+1}]=s[i]-'0'; } mp[{n,1}]=mp[{1,n}]=s[s.size()-1]-'0'; forn(i,n-3){ ll x,y,z; cin>>x>>y>>z; mp[{x,y}]=mp[{y,x}]=z; } ll chk=2; vii v; forx(i,1,n+1) v.pb(i); while(v.size()>=3){ if(v.size()>3){ ll ind=0; forn(i,v.size()){ if(mp[{v[i],v[(i+2)%v.size()]}]>0){ ind=i+1; break; } } if(ind==0){ chk=0; break; } ind--; ll iind=ind; forn(i,(v.size()+1)/2){ if(mp[{v[ind],v[(ind+2)%v.size()]}]==0) chk=0; if(mp[{v[ind],v[(ind+2)%v.size()]}]!=mp[{v[ind],v[(ind+1)%v.size()]}]){ if(mp[{v[ind],v[(ind+1)%v.size()]}]!=mp[{v[(ind+1)%v.size()],v[(ind+2)%v.size()]}]){ if(mp[{v[ind],v[(ind+2)%v.size()]}]!=mp[{v[(ind+1)%v.size()],v[(ind+2)%v.size()]}]) continue; chk=1; } else chk=1; } else chk=1; ind+=2; ind%=v.size(); } vii vv; forn(i,(v.size()+1)/2){ vv.pb(v[iind]); iind+=2; iind%=v.size(); } v.clear(); for(auto it:vv) v.pb(it); } else{ if(min(mp[{v[1],v[2]}],min(mp[{v[0],v[1]}],mp[{v[0],v[2]}]))==0) chk=0; else{ if(mp[{v[1],v[2]}]==mp[{v[0],v[1]}]) chk=1; if(mp[{v[1],v[2]}]==mp[{v[0],v[2]}]) chk=1; if(mp[{v[0],v[1]}]==mp[{v[0],v[2]}]) chk=1; } break; } } if(chk==0) cout<<"neispravna triangulacija"; else if(chk==1) cout<<"neispravno bojenje"; else cout<<"tocno"; return 0; } /* */

Compilation message (stderr)

checker.cpp: In function 'int main()':
checker.cpp:20:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define forn(i,n) for(ll i=0;i<n;i++)
......
   63 |   forn(i,s.size()-1){
      |        ~~~~~~~~~~~~            
checker.cpp:63:3: note: in expansion of macro 'forn'
   63 |   forn(i,s.size()-1){
      |   ^~~~
checker.cpp:20:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define forn(i,n) for(ll i=0;i<n;i++)
......
   79 |     forn(i,v.size()){
      |          ~~~~~~~~~~            
checker.cpp:79:5: note: in expansion of macro 'forn'
   79 |     forn(i,v.size()){
      |     ^~~~
checker.cpp:20:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define forn(i,n) for(ll i=0;i<n;i++)
......
   91 |     forn(i,(v.size()+1)/2){
      |          ~~~~~~~~~~~~~~~~      
checker.cpp:91:5: note: in expansion of macro 'forn'
   91 |     forn(i,(v.size()+1)/2){
      |     ^~~~
checker.cpp:20:31: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define forn(i,n) for(ll i=0;i<n;i++)
......
  109 |     forn(i,(v.size()+1)/2){
      |          ~~~~~~~~~~~~~~~~      
checker.cpp:109:5: note: in expansion of macro 'forn'
  109 |     forn(i,(v.size()+1)/2){
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...