Submission #668108

#TimeUsernameProblemLanguageResultExecution timeMemory
668108ManoushDijamant (COCI22_dijamant)C++14
0 / 70
2 ms852 KiB
#include <bits/stdc++.h> #define ll long long int #define F first #define S second #define pb push_back using namespace std; vector<set<ll>>v(2003); ll n,m; ll fun1 (ll x,ll y) { //cout<<"hello "<<x<<" "<<y<<endl; if (x==INT_MAX)return 0; ll q=*v[y].lower_bound(x+1); if (q==INT_MAX||q==INT_MIN)return 0; ll sum=q-x-1; //cout<<" sum "<<sum<<" "<<q<<endl; if (sum%2==0)return 0; if (y<sum/2+1||(m-y)<sum/2+1)return 0; ll u=(q-x)/2; //cout<<"u "<<u<<endl; ll con=1; for (ll i=1;i<u;i++) { // cout<<"1 "<<y+i<<" "<<x+i<<endl; ll x1=*v[y+i].lower_bound(x+i); //cout<<"2 "<<y-i<<" "<<x+i<<endl; ll x2=*v[y-i].lower_bound(x+i); //cout<<"3 "<<y+i<<" "<<x1+1<<endl; ll y1=*v[y+i].lower_bound(x1+1); //cout<<"4 "<<y-i<<" "<<x2+1<<endl; ll y2=*v[y-i].lower_bound(x2+1); //cout<<x1<<" "<<x2<<" "<<y1<<" "<<y2<<endl; if (y1!=q-i||y2!=q-i) return 0; } ll f1=*v[y+u].lower_bound(x+u); ll f2=*v[y-u].lower_bound(x+u); //cout<<f1<<" f "<<f2<<endl; if (f1!=x+u||f2!=x+u)return 0; return 1; } int main() { cin>>n>>m; char c; for (ll i=1;i<=m;i++) { v[i].clear(); } for (ll i=1;i<=n;i++) { for (ll j=1;j<=m;j++) { cin>>c; if (c=='#')v[j].insert(i); } } for (ll i=1;i<=m;i++) { v[i].insert(INT_MAX); } /*for (ll i=1;i<=m;i++) { cout<<i<<endl; for (auto it:v[i]) { cout<<it<<" "; } cout<<endl; }*/ ll ans=0; for (ll i=1;i<=m;i++) { for (auto it:v[i]) { ll u=fun1(it,i); ans+=u; // cout<<u<<endl; } } cout<<ans<<endl; /* hello 1 11 sum 3 5 u 7 1 12 2 2 10 2 3 12 3 4 10 3 2 2 4 4 1 13 3 2 9 3 3 13 4 4 9 4 3 3 2147483647 2147483647 0 */ return 0; }

Compilation message (stderr)

Main.cpp: In function 'long long int fun1(long long int, long long int)':
Main.cpp:22:8: warning: unused variable 'con' [-Wunused-variable]
   22 |     ll con=1;
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...