# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
668108 | 2022-12-02T18:46:40 Z | Manoush | Dijamant (COCI22_dijamant) | C++14 | 2 ms | 852 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 852 KB | Output is correct |
3 | Incorrect | 2 ms | 596 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 852 KB | Output is correct |
3 | Incorrect | 2 ms | 596 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |