Submission #100325

# Submission time Handle Problem Language Result Execution time Memory
100325 2019-03-10T11:45:56 Z AKaan37 Mobitel (COCI19_mobitel) C++17
0 / 130
67 ms 66560 KB
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//Bismillahirrahmanirrahim
#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< lo,pair<lo,lo> > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(lo i=1;i<=n;i++)
#define mid (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

lo n,m,cev,b,a[1005][1005],k,dp[305][305][1005];
string s;
vector<int> v;
//~ map< PII,lo> dp;

lo bfs(lo satir,lo sutun,lo cost){
	lo topl=0;
	if(satir>n || sutun>m) return 0;
	if(satir==n && sutun==m && cost>=k) return 1;
	if(satir==n && sutun==m && cost<k) return 0;
	if(~dp[satir][sutun][cost]) return dp[satir][sutun][cost];
	topl+=bfs(satir+1,sutun,cost*a[satir+1][sutun]);
	topl+=bfs(satir,sutun+1,cost*a[satir][sutun+1]);
	return dp[satir][sutun][cost]=topl;
}

int main(){
	freopen("CfE.cpp","r",stdin);
	memset(dp,-1,sizeof(dp));
	scanf("%lld %lld %lld",&n,&m,&k);
	FOR{
		for(lo j=1;j<=m;j++){
			scanf("%lld",&a[i][j]);
		}
	}
	printf("%lld\n",bfs(1,1,a[1][1]));
	return 0;
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:43:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("CfE.cpp","r",stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
mobitel.cpp:45:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %lld",&n,&m,&k);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
mobitel.cpp:48:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld",&a[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 65 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 66 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 64 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 65 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 67 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 64 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 61 ms 66560 KB Execution killed with signal 9 (could be triggered by violating memory limits)