답안 #202268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
202268 2020-02-15T00:41:05 Z Segtree Selling RNA Strands (JOI16_selling_rna) C++14
10 / 100
6 ms 376 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
string s[110];
int main(){
    int n,m;
    cin>>n>>m;
    if(n>100)return 0;
    rep(i,n)cin>>s[i];
    rep(i,m){
	string p,q;
	cin>>p>>q;
	ll ans=0;
	rep(i,n){
	    ll ver=0;
	    if(s[i].size()>=p.size()){
		bool ok=1;
		rep(j,p.size())ok&=(s[i][j]==p[j]);
		ver+=ok;
	    }
	    if(s[i].size()>=q.size()){
		bool ok=1;
		rep(j,q.size())ok&=(s[i][s[i].size()-1-j]==q[q.size()-1-j]);
		ver+=ok;
	    }
	    if(ver==2)ans++;
	}
	cout<<ans<<endl;
    }
}


Compilation message

selling_rna.cpp: In function 'int main()':
selling_rna.cpp:13:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n) for(int i=0;i<n;i++)
selling_rna.cpp:30:7:
   rep(j,p.size())ok&=(s[i][j]==p[j]);
       ~~~~~~~~~~               
selling_rna.cpp:30:3: note: in expansion of macro 'rep'
   rep(j,p.size())ok&=(s[i][j]==p[j]);
   ^~~
selling_rna.cpp:13:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,n) for(int i=0;i<n;i++)
selling_rna.cpp:35:7:
   rep(j,q.size())ok&=(s[i][s[i].size()-1-j]==q[q.size()-1-j]);
       ~~~~~~~~~~               
selling_rna.cpp:35:3: note: in expansion of macro 'rep'
   rep(j,q.size())ok&=(s[i][s[i].size()-1-j]==q[q.size()-1-j]);
   ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 128 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 128 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Incorrect 5 ms 256 KB Output isn't correct
9 Halted 0 ms 0 KB -