This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bitset<200000> edg[200000][3],temp;
int main()
{
int n;
cin>>n>>n;
string s;
cin>>s;
vector<pair<int,int>> nei[n+1];
for (int i=0;i<n-1;i++)
{
nei[i].push_back({i+1,s[i]});
nei[i+1].push_back({i,s[i]});
edg[i][s[i]-'1'].set(i+1);
edg[i+1][s[i]-'1'].set(i);
}
nei[0].push_back({n-1,s[n-1]});
nei[n-1].push_back({0,s[n-1]});
edg[0][s[n-1]-'1'].set(n-1);
edg[n-1][s[n-1]-'1'].set(0);
for (int i=0;i<n-3;i++)
{
int u,v,w;
cin>>u>>v>>w;
u--,v--,w--;
nei[u].push_back({v,w});
nei[v].push_back({u,w});
edg[u][w].set(v);
edg[v][w].set(u);
}
int tr=0,ptr=0;
for (int u=0;u<n;u++)
{
for (auto i:nei[u])
for (int j=0;j<3;j++)
for (int k=0;k<3;k++)
{
temp=edg[u][j]&edg[i.first][k];
tr+=temp.count();
if (j!=k && i.second!=j && i.second!=k)
ptr+=temp.count();
}
}
tr/=6;
ptr/=6;
if (tr!=n-2)
cout<<"neispravna triangulacija"<<endl;
else if(ptr!=n-2)
cout<<"neispravno bojenje"<<endl;
else
cout<<"tocno"<<endl;
return 0;
}
Compilation message (stderr)
/tmp/ccSTxgkt.o: in function `main':
checker.cpp:(.text.startup+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
checker.cpp:(.text.startup+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
checker.cpp:(.text.startup+0x46e): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
checker.cpp:(.text.startup+0x7e8): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
checker.cpp:(.text.startup+0x873): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
checker.cpp:(.text.startup+0x896): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/ccSTxgkt.o: in function `_GLOBAL__sub_I_edg':
checker.cpp:(.text.startup+0x95b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
checker.cpp:(.text.startup+0x979): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status